Add new class to the row

Add new class to the row

SproSpro Posts: 3Questions: 0Answers: 0
edited December 2011 in General
Hi Allan =)

I'm trying to improve the delete function to be more intuitive
Today it works this way:
- When I click the button (delete) this function is triggered
[code]
function confirma_delete(name, table) {
var answer = confirm("Remover linha " + name + "?"); // Do you want to remove the line?
if (answer) {
valor = "row_id=" + name + "&table=" + table;
newXmlRequest(valor,'./delete_ajax.php'); // delete_ajax.php is responsible for the rest
}
}
[/code]
The button
[code]

[/code]
But the deletion will only occur when I click on (Save Changes) it will be processed on the database.
I want to change the color of the line that was "confirmed to be deleted" to gradeX.

On the function confirma_delete how can I (implement a function to) add a new class (gradeX) to that row after the confirmation?
What parameters I must pass to do this?

Here is the live example
www.spro.com.br/fernando/editable.php

btw, datatables is completely awesome! and Visual Event too!

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    If I understand correctly, then you could do something like this:

    [code]
    function confirma_delete(name, table) {
        var answer = confirm("Remover linha " + name + "?"); // Do you want to remove the line?
        if (answer) {
            valor = "row_id=" + name + "&table=" + table;
            newXmlRequest(valor,'./delete_ajax.php'); // delete_ajax.php is responsible for the rest
    $(this).parents('tr').addClass( 'gradeX' );
        }
    }
    [/code]

    That will find the TR parent of the button that was clicked on and add the gradeX class.

    Thanks for the kind words :-)

    Regards,
    Allan
This discussion has been closed.