DataTables-Hide-Empty-Columns
DataTables-Hide-Empty-Columns copied to clipboard
performance issues on big tables
There is significant lag on a tables with 5000+ rows and 30 or so columns. So I propose couple of optimisations.
First, break loop on first non empty column found as there is no point to check rest of columns as result is already predetermined:
for (var i = info.start; i < info.end; i++)
if (_isEmpty(data[i]))
empty++
else
break;
Second, which brings most benefit - is to disable "redraw" upon each column setting visible or not:
if (empty === (info.end - info.start)) { api.column(this.index()).visible(false, false) } else { api.column(this.index()).visible(true, false) }
after calling _checkPage() do api.draw();
Thanks for the heads up, ill work on this asap and get it fixed.
I like you proposed solutions, I will test those out and implement them!
Any update yet?
Hi . i have same problem. i have 900+ columns and 20+ rows but when i set table to hide empty columns it take long time ( for example it's take 6 second to hide ) please guide to reduce time .thanks
I have implemented these changes long ago in my project and I don't have performance problems with thousands of rows
lapkritinis solution is 100% working.
First of all - a great extension, with great functions. Well programmed and commented!
I downloaded the latest release, which does have the suggestions from @lapkritinis already implemented (I guess). A search w.o. takes with 60k rows 1sec - with enabled plugin it takes up to 15sec.
Any further optimisations, suggestions? Thanks.