After hiding rows in a table, want to regresh pagination
After hiding rows in a table, want to regresh pagination
quentinjs@gmail.com
Posts: 2Questions: 1Answers: 0
Link to test case:
Debugger code (dIebug.datatables.net):
Error messages shown:
Description of problem:
Answers
Client Side. I have the below code to add GroupRows to a table. When the button next to each is pressed, the section hides.
Sorry for the length
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
DataTables doesn't have a concept of hiding rows - either the rows are there, or they aren't. You're working around this by hiding the rows with CSS classes, but the rows are still within the DataTables internal structures - that means the pagination won't consider that, those rows will always be displayed albeit displayed hidden, so a redraw won't solve anything.
An alternative approach would be to delete the rows from the table, instead of hiding them - that way the pagination would redraw as you require. If you get the row's data first, you can then re-add those rows with that data later. You would use
rows().remove()
(orrow().remove()
to individually remove them),rows().data()
to get the data, androws.add()
to re-add the records,Colin