mirror of
https://github.com/getredash/redash.git
synced 2025-12-25 01:03:20 -05:00
QueryFiddle: reset sorting when executing query. fixes #33
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
///////////*/
|
||||
|
||||
Reference in New Issue
Block a user