ColumnFilterWidgets icon indicating copy to clipboard operation
ColumnFilterWidgets copied to clipboard

ColumnFilterWidget.prototype.fnDraw on table redraw slows loading, sorting, etc

Open recarv opened this issue 10 years ago • 2 comments

When dealing with large datasets, the performance slowdown on re-populating the select dropdowns on any change in the datatable redraw is significant and the cost is exponential. In a test on a table with 10 columns and 11k rows, the load time goes from 8sec to 25sec in Firefox (no firebug). Furthermore when using the sorting plugin and sorting, this triggers a redraw which slows down sorts significantly as well.

While I understand the helpfulness of maintaining updated filterable values, I would recommend adding a way to make this function called more selectively and leave that option up to the developer to trigger manually - such as on a filter selection.

I've commented out the fnDraw() below and this greatly speeds loading and sorts.

oDataTableSettings.aoDrawCallback.push( { name: 'ColumnFilterWidgets', fn: function() { $.each( me.aoWidgets, function( i, oWidget ) { //oWidget.fnDraw(); } ); } } );

recarv avatar Jan 11 '15 15:01 recarv

I encountered the same symptoms with large data sets: its too much time costing to re-populate the widget selects on each table redraw (this affects paginating aswell...).

I'd rather trigger the widget redraw on data manipulation events such as a search callback (with a delay to prevent the same problem occurence while typing in the search bar for example)...

I will investigate this problem and create a pull request once i have a viable solution.

DjTrilogic avatar Apr 01 '16 09:04 DjTrilogic

Thanks guys, I'm happy to look at a pull request. It looks like removing the draw breaks updating widgets to contain only valid values for the current filters, but there are probably more efficient ways to achieve that.

cyberhobo avatar Apr 14 '16 02:04 cyberhobo