Get information about the line the user delete

Get information about the line the user delete

hdsahdsa Posts: 7Questions: 0Answers: 0
edited October 2013 in Editor
Hi,
I need to get the information on the line the user selected to delete so rather saying "Are you sure you wish to delete 1 row?" say, for example, "Are you sure you wish to delete the user named John?"

And more, to do something like:

if ( isset( $_POST['action'] ) && $_POST['action'] === 'delete' )
{
$query="INSERT INTO Logs SET LOG="User with ID:".$_POST['data']['IDUser']." Have been deleted";
$db->sql($query);
}

How can I do this?

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    Hi,

    So the way you would do this is using the `remove()` API: http://editor.datatables.net/api/#remove . Specifically you might have something like:

    [code]
    var data = table._('tr.DTTT_selected');

    editor.message( "Are you sure you wish to delete the user named "+data[0].name+"?" );
    editor.remove( row_to_delete, 'Delete row', {
    "label": "Confirm",
    "fn": function () { this.submit(); }
    } );
    [/code]

    where `table` is the DataTable instance and `editor` is the Editor instance.

    Regards,
    Allan
This discussion has been closed.