How to remove an element from table? Fix problem!!!

How to remove an element from table? Fix problem!!!

gilbertoalbinogilbertoalbino Posts: 2Questions: 0Answers: 0
edited May 2012 in General
Hi there, this is my first post on DataTables forum.
I am running accross a situation:
I've created a user list and added the actions for update and delete in the very right of the table in a column called 'Actions';
somewhat like this:

[ username ] [ user_email ] [ actions ]
[ John Doe ] [john@doe.com ] [ Edit - Remove ]

The in the click action for 'Remove' I've set this code:

[code]
jQuery('.delete').click(
function() {
var id = jQuery( this ).parent().attr( 'id');
$( '#' + id ).parent().remove();
jQuery.ajax({
url : '/admin/ajax/user/delete/id/' + id,
type : 'GET'
});
}
);
[/code]

This code does exactly what it is supposed to do BUT when I paginate the table and get back to the same page where it was before, it is listed again as if the table had built all the list all over again.

Any clue of how to remove definitely from DataTable?

Replies

  • UPEngineerUPEngineer Posts: 93Questions: 0Answers: 1
    Looks like you just removed it from the DOM. Does your ajax remove the id from the source too? If so, you may need to refresh your source after the delete.
  • gilbertoalbinogilbertoalbino Posts: 2Questions: 0Answers: 0
    I remove the DOM, yep. But once removed how come DataTable sorts removed DOM elements?
This discussion has been closed.