Selecting All Rows and table.on('draw')
Selecting All Rows and table.on('draw')
This test case includes a simulated large table with 80000 results: https://live.datatables.net/qejufuqi/1/edit
There is a button Select All Rows that selects both the main rows and the subrows.
table.on('draw')
function makes sure that subrows are still selected when changing pages as without this function, only the main rows stay selected when switching pages.
table.on('click','tr',function(e))
function makes sure relevant subrows are selected when a main row is selected.
The problem is that table.on('draw')
runs too slowly when there are so many results which is an issue when all rows are selected and the page changed.
What could be done to improve performance of table.on('draw')
or is there maybe another approach to this?
This question has an accepted answers - jump to answer
Answers
No need to use Javascript to add a class to the child row. Use this CSS selector:
That says, get any
tr
which is directly after atr.selected
element. Then you have no need for a draw event handler at all: https://live.datatables.net/celuwato/1/editAllan
Fantastic, thank you!