Is it possible keep rows selected when using ajax.reload()?
Is it possible keep rows selected when using ajax.reload()?
Hi,
I modified the example in
https://datatables.net/examples/api/select_row.html
To select more than one row and delete them. Please see my modified code below
$('#example tbody').on( 'click', 'tr', function () {
if ( $(this).hasClass('selected') ) {
$(this).removeClass('selected');
}
else {
table.$('tr.selected');//.removeClass('selected');
$(this).addClass('selected');
}
} );
$('#delete').click( function () {
table.rows('.selected').remove().draw( false );
} );
However, I also use ajax.reload
to update my rows. But when using ajax.reload()
, my selection will disappear. Is there a way to keep selected rows when I am using ajax.reload().
Many thanks,
Golnaz
Answers
This thread should help, example here, it's asking the same thing.
Cheers,
Colin