I have datatable server-side in modal(popup) to select item by select checkbox in item row.
But when i change page, sorting, and search other item, my selected item in checkbox always reset or reload.
Did datatable server-side can remember my selected checkbox? And if can, how to implement it in my case?
Although it's undocumented but stateSave
option only works in client-side processing mode as far as I know.
Please see jQuery DataTables Checkboxes extension that provides universal solution for working with checkboxes in a table in both client-side and server-side processing modes.
For example:
var table = $('#example').DataTable({
'processing': true,
'serverSide': true,
'ajax': '/your/script',
'columnDefs': [
{
'targets': 0,
'checkboxes': true
}
],
'order': [[1, 'asc']]
});
Alternatively, if you want to implement it yourself without a plug-in, see jQuery DataTables: Row selection using checkboxes article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With