Performance 1.9 vs 1.10 when manipulating all rows
Performance 1.9 vs 1.10 when manipulating all rows
bholub
Posts: 6Questions: 1Answers: 0
I have a table with a checkbox column. I have a toggle all checkboxes at the top to check/uncheck all at once. It's fast in 1.9 but slow in 1.10 so I'm guessing I'm doing it in a less than ideal way... any feedback would be greatly appreciated:
1.9 method:
var rows = reportingTable.$('tr', {filter: 'applied'});
rows.each(function(index) {
if (target.is(':checked')) {
reportingTable.fnUpdate(true,this,0,false,false);
} else {
reportingTable.fnUpdate(false,this,0,false,false);
}
});
1.10 method:
var rows = reportingTable.rows({search: "applied"}).indexes().each(function(idx) {
var d = reportingTable.row( idx ).data();
d.checked = (target.is(":checked"));
reportingTable.row( idx ).data( d );
});
reportingTable.draw();
This discussion has been closed.
Answers
EDIT: I thought I solved it below, but in reality that just grabs the visible rows. My table is paged, so this is not the solution. Still working on it, but if anyone has thoughts please let me know! Thanks!
I was able to get much better performance going straight to the cells:
You could try using the
$()
method:Are you looking just to set the checked state of the checkboxes? How about:
?
Allan
I'll try it and report back, but I believe I need to change the underlying data because I have buttons that act on the data (download selected rows to CSV). I think I tried just checking the boxes, which was fast, but it only selected the visible page.