Skip to content

Commit 441f9c6

Browse files
committed
QueryFiddle: reset sorting when executing query. fixes #33
1 parent d4e484f commit 441f9c6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

rd_ui/app/scripts/query_fiddle/renderers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ renderers.directive('gridRenderer', function () {
123123
isPaginationEnabled: true,
124124
itemsByPage: $scope.itemsPerPage || 15,
125125
maxSize: 8
126-
}
126+
};
127127

128128
$scope.$watch('queryResult && queryResult.getData()', function (data) {
129129
if (!data) {

rd_ui/app/scripts/smart-table.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@
113113

114114
//if item are added or removed into the data model from outside the grid
115115
scope.$watch('dataCollection', function (oldValue, newValue) {
116-
if (oldValue !== newValue) {
117-
ctrl.sortBy();//it will trigger the refresh... some hack ?
116+
// evme:
117+
// reset sorting when data updates (executing query again)
118+
if (newValue) {
119+
ctrl.resetSort();
118120
}
119121
});
120122

@@ -496,6 +498,12 @@
496498
return scope.isPaginationEnabled ? arrayUtility.fromTo(output, (scope.currentPage - 1) * scope.itemsByPage, scope.itemsByPage) : output;
497499
};
498500

501+
this.resetSort = function() {
502+
lastColumnSort = null;
503+
predicate = {};
504+
this.sortBy();
505+
};
506+
499507
/*////////////
500508
Column API
501509
///////////*/

0 commit comments

Comments
 (0)