Skip to content

Commit 9d3b222

Browse files
committed
match the arguments of sortFn with fn; incorporate sortFn into the internal sorting logic
1 parent 27398c0 commit 9d3b222

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/reactive_table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ Template.reactiveTable.helpers({
491491
});
492492
} else {
493493
var sortByValue = _.all(getSortedFields(this.fields, this.multiColumnSort), function (field) {
494-
return field.sortByValue || !field.fn;
494+
return !field.sortFn || field.sortByValue || !field.fn;
495495
});
496496
var filterQuery = getFilterQuery(getFilterStrings(this.filters.get()), getFilterFields(this.filters.get(), this.fields), {enableRegex: this.enableRegex, filterOperator: this.filterOperator});
497497

lib/sort.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ sortWithFunctions = function (rows, fields, multiColumnSort) {
8787
_.each(sortedFields.reverse(), function (field) {
8888
if (field.sortFn) {
8989
sortedRows = _.sortBy(sortedRows, function (row) {
90-
return field.sortFn(row);
90+
return field.sortFn( get( row, field.key ), row );
9191
});
9292
} else if (field.sortByValue || !field.fn) {
9393
sortedRows = _.sortBy(sortedRows, field.key);

0 commit comments

Comments
 (0)