Hi,
I am calculating sums column by colum on a table with more than 1000 lines and 19 columns.
It takes a few seconds each time, and I'd like it to be fluid.
The trick is that some colums and rows can be hidden, so it can't just be an operation on DOM nodes.
Here the piece of code I use which I guess is not optimized :
Is there a way in v1.10 to optimize the called apis within the loops ?
Thx
Alban
I am calculating sums column by colum on a table with more than 1000 lines and 19 columns.
It takes a few seconds each time, and I'd like it to be fluid.
The trick is that some colums and rows can be hidden, so it can't just be an operation on DOM nodes.
Here the piece of code I use which I guess is not optimized :
var tabTotal = {}; $(latable.fnSettings().aoData).each(function(index, element) { for (var index2=0 ; index2<latable.fnSettings().aoColumns.length ; index2++) { if (typeof tabTotal[index2] === "undefined") tabTotal[index2] = 0; tabTotal[index2] += $(latable.api(true).cell(index,index2).nodes()).text(); } }); for ( var i in tabTotal) { $(latable.dataTableSettings[0].aoFooter[0][i]['cell']).text(tabTotal[i]); }
Is there a way in v1.10 to optimize the called apis within the loops ?
Thx
Alban