Skip to content

Commit

Permalink
Fix suggestion for lorenzofox3#329 / lorenzofox3#388
Browse files Browse the repository at this point in the history
Added parameter to the sort function which is only be used for the sortDefault behaviour for the first call. To fix the problem that the pipe called twice
  • Loading branch information
MrWook authored Jul 3, 2017
1 parent 716845b commit 590a59b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/stSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ng.module('smart-table')
}

//view --> table state
function sort () {
function sort (defaultSortActive) {
if (descendingFirst) {
index = index === 0 ? 2 : index - 1;
} else {
Expand All @@ -43,7 +43,7 @@ ng.module('smart-table')
if (promise !== null) {
$timeout.cancel(promise);
}
if (throttle < 0) {
if (throttle < 0 || (defaultSortActive != undefined && defaultSortActive == true)) {
func();
} else {
promise = $timeout(func, throttle);
Expand All @@ -58,7 +58,7 @@ ng.module('smart-table')

if (sortDefault) {
index = sortDefault === 'reverse' ? 1 : 0;
sort();
sort(true);
}

//table state --> view
Expand Down

0 comments on commit 590a59b

Please sign in to comment.