QueryFiddle: reset sorting when executing query. fixes #33

This commit is contained in:
Amir Nissim
2014-01-23 14:57:08 +02:00
parent d4e484fd82
commit 441f9c677a
2 changed files with 11 additions and 3 deletions

View File

@@ -123,7 +123,7 @@ renderers.directive('gridRenderer', function () {
isPaginationEnabled: true,
itemsByPage: $scope.itemsPerPage || 15,
maxSize: 8
}
};
$scope.$watch('queryResult && queryResult.getData()', function (data) {
if (!data) {

View File

@@ -113,8 +113,10 @@
//if item are added or removed into the data model from outside the grid
scope.$watch('dataCollection', function (oldValue, newValue) {
if (oldValue !== newValue) {
ctrl.sortBy();//it will trigger the refresh... some hack ?
// evme:
// reset sorting when data updates (executing query again)
if (newValue) {
ctrl.resetSort();
}
});
@@ -496,6 +498,12 @@
return scope.isPaginationEnabled ? arrayUtility.fromTo(output, (scope.currentPage - 1) * scope.itemsByPage, scope.itemsByPage) : output;
};
this.resetSort = function() {
lastColumnSort = null;
predicate = {};
this.sortBy();
};
/*////////////
Column API
///////////*/