Problem with Checkbox in row not working correctly on Pagination
Problem with Checkbox in row not working correctly on Pagination
liquidpractice
Posts: 3Questions: 0Answers: 0
This is a simple problem that I don't understand why datatables breaks on.
I have a basic table with some columns. The first column has checkboxes, one for each row. All the boxes start off checked.
The datatable has server side processing checked.
"bProcessing": true
"bServerSide": true
Now when I un-check a box all seems well.... But when I page to the next row of items and come back with the pagination controls my unchecked box "magically" checks itself again. VERY annoying and a surprisingly simple problem for such an advanced product.
I noticed that if I un-check a box then page to the next set of rows and THEN put a space in the filter input field... then paginate back to my original set of rows where I checked the box... the box is correctly not checked!
So something happens when you put something in the filter input field that causes the datatable to sync up with the server and get the checkboxes working right between paginations.
The answer then for my problem would seem that after a box is checked I simply need to call "some method" that will make the datatable sync up much like when you put a space in the filter input field.
I tried:
fnDraw() - Doesn't call the server... so that's not it.
fnGetData() - Doesn't call the server .. so that's not it.
fnGetNodes() - Doesn't call the server.. so that's not it.
fnReloadAjax() - Doesn't call the server.. so that's not it.
fnFilter() - DOES call the server... but doesn't work because if you are on page 2+ you get reset back to page 1.
What call could I do that will make the datatable actually sync up with the server and my boxes will have their state correct?
Thanks,
LiquidPractice
I have a basic table with some columns. The first column has checkboxes, one for each row. All the boxes start off checked.
The datatable has server side processing checked.
"bProcessing": true
"bServerSide": true
Now when I un-check a box all seems well.... But when I page to the next row of items and come back with the pagination controls my unchecked box "magically" checks itself again. VERY annoying and a surprisingly simple problem for such an advanced product.
I noticed that if I un-check a box then page to the next set of rows and THEN put a space in the filter input field... then paginate back to my original set of rows where I checked the box... the box is correctly not checked!
So something happens when you put something in the filter input field that causes the datatable to sync up with the server and get the checkboxes working right between paginations.
The answer then for my problem would seem that after a box is checked I simply need to call "some method" that will make the datatable sync up much like when you put a space in the filter input field.
I tried:
fnDraw() - Doesn't call the server... so that's not it.
fnGetData() - Doesn't call the server .. so that's not it.
fnGetNodes() - Doesn't call the server.. so that's not it.
fnReloadAjax() - Doesn't call the server.. so that's not it.
fnFilter() - DOES call the server... but doesn't work because if you are on page 2+ you get reset back to page 1.
What call could I do that will make the datatable actually sync up with the server and my boxes will have their state correct?
Thanks,
LiquidPractice
This discussion has been closed.
Replies
Its because you are using server-side processing. If you weren't it would work just fine - and its the nature of server-side processing, so not a bug that can be fixed, but rather than issue that needs to be worked around in your code - using a method like that highlighted in the DataTables example in the linked thread.
Allan