Skip to content

Commit

Permalink
Merge pull request #11315 from piwik/fastertables2x
Browse files Browse the repository at this point in the history
Fix Piwik UI becomes very slow when having many rows
  • Loading branch information
tsteur authored Feb 17, 2017
2 parents 17230c4 + a3d8280 commit 3b16730
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plugins/CoreHome/javascripts/dataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ $.extend(DataTable.prototype, UIControl.prototype, {
this.workingDivId = this._createDivId();
domElem.attr('id', this.workingDivId);

this.maxNumRowsToHandleEvents = 255;
this.loadedSubDataTable = {};
this.isEmpty = $('.pk-emptyDataTable', domElem).length > 0;
this.bindEventsAndApplyStyle(domElem);
Expand Down Expand Up @@ -1502,8 +1503,13 @@ $.extend(DataTable.prototype, UIControl.prototype, {
$nodes.off('click');
$nodes.on('click', toggleFooter);
},

canHandleRowEvents: function (domElem) {
return domElem.find('table > tbody > tr').size() <= this.maxNumRowsToHandleEvents;
},
handleColumnHighlighting: function (domElem) {
if (!this.canHandleRowEvents(domElem)) {
return;
}

var maxWidth = {};
var currentNthChild = null;
Expand Down Expand Up @@ -1788,6 +1794,10 @@ $.extend(DataTable.prototype, UIControl.prototype, {

// also used in action data table
doHandleRowActions: function (trs) {
if (!trs || trs.length > this.maxNumRowsToHandleEvents) {
return;
}

var self = this;

var merged = $.extend({}, self.param, self.props);
Expand Down

0 comments on commit 3b16730

Please sign in to comment.