All checkboxes deselected after table.ajax.reload
Closed this issue · 3 comments
I am using the latest version.
Unfortunately, state saving is not working as expected.
After selecting the checkboxes, if I click on the button that performs table.ajax.reload, the selected checkboxes get unselected.
However, the rest (sorting, paging, etc) stays kept.
Please, help me... I have spent hours trying to find an answer but in vain.
Regards
Most likely the issue is that your column containing checkboxes has no data. In order to have checkboxes state saved, column containing checkboxes must have unique values.
Please see this example for code and demonstration.
Also there is State saving page demonstrating other related options.
If that doesn't solve you issue, please create an example on jsFiddle reproducing it. Thanks!
UPDATE!
I have solved the issue by adding the following array >> array( 'db' => 'users
.id
', 'dt' => 'DT_RowId', 'field' => 'id' )
Since the 'DT_RowId' is essential as it defines the unique value of each column, we have to make sure that it is included in the PHP script. (In my case I am using SSP.class)
$columns = array(
//array( 'db' => 'users
.email
'),
array( 'db' => 'users
.id
', 'dt' => 'DT_RowId', 'field' => 'id' ),
array( 'db' => 'users
.operator
', 'dt' => 0, 'field' => 'operator' ),
array( 'db' => 'users
.operator
', 'dt' => 1, 'field' => 'operator' ),
array( 'db' => 'users
.email
', 'dt' => 2, 'field' => 'email' ),
array( 'db' => 'users
.mobile
', 'dt' => 3, 'field' => 'mobile' ),
array( 'db' => 'users
.pin
', 'dt' => 4, 'field' => 'pin' ),
array( 'db' => 'users
.threshold
', 'dt' => 5, 'field' => 'threshold' ),
array( 'db' => 'users
.password
', 'dt' => 6, 'field' => 'password' ),
array( 'db' => 'users
.name
', 'dt' => 7, 'field' => 'name' ),
array( 'db' => 'users
.surname
', 'dt' => 8, 'field' => 'surname' ),
array( 'db' => 'users
.date_last
', 'dt' => 9, 'field' => 'date_last' ),
);
Thanks to the Author for the help and the project itself.