gyrocode/jquery-datatables-checkboxes

Problem with selected rows + stateSave + table.ajax.reload + removed data

flowerpower opened this issue · 2 comments

This is the problem:
I have a dataTable with some rows loaded with ajax from database, I use the table.ajax.reload function (for reloading data every 10 seconds) and the stateSave (for keep selected rows after every reload of data).

  1. I select 3 rows and the selected row counter on the table footer correctly say: "3 rows selected".
  2. I remove from database one of the selected rows.
  3. The table.ajax.reload function runs and reloads the data on the table and now there are a lower number of rows.
  4. Now the remaining visible selected rows is correctly 2 (because one is been removed from database) but the rows counter on the footer of the table count a wrong number! The counter say again "3 rows selected" !!!

How can I solve this problem?

is it server side ajax ?
dont use stateSave,
add option serverSide: true,

I have solved the problem. The magic tip is to use the rowId option!!
In my example the rowId value is wrong, I need to use a unique json item returned from the ajax call. In my case:
for example:
rowId: 'Collocation'
where Collocation is an item of my json.