Skip to content

Commit c9a3272

Browse files
committed
Improved refilter on sort - do the work on a smaller set
1 parent 4c7880f commit c9a3272

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,8 @@ DGTable.prototype._refilter = function() {
11671167
var that = this, p = that.p;
11681168

11691169
if (p.filteredRows && p.filterArgs) {
1170-
p.filteredRows = p.rows.filteredCollection(p.filterArgs);
1170+
var filterFunc = that.o.filter || ByColumnFilter;
1171+
p.filteredRows = p.rows.filteredCollection(filterFunc, p.filterArgs);
11711172
}
11721173
return this;
11731174
};
@@ -1343,7 +1344,9 @@ DGTable.prototype.sort = function (column, descending, add) {
13431344

13441345
if (currentSort.length) {
13451346
p.rows.sort(!!p.filteredRows);
1346-
this._refilter();
1347+
if (p.filteredRows) {
1348+
p.filteredRows.sort(!!p.filteredRows);
1349+
}
13471350
}
13481351

13491352
// Build output for event, with option names that will survive compilers
@@ -1379,8 +1382,10 @@ DGTable.prototype.resort = function () {
13791382
p.rows.sortColumn = currentSort;
13801383
if (currentSort.length) {
13811384
p.rows.sort(!!p.filteredRows);
1385+
if (p.filteredRows) {
1386+
p.filteredRows.sort(!!p.filteredRows);
1387+
}
13821388
}
1383-
this._refilter();
13841389

13851390
// Build output for event, with option names that will survive compilers
13861391
var sorts = [];

0 commit comments

Comments
 (0)