Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Reset the offset when applying filters to grids
Browse files Browse the repository at this point in the history
fixes #9891
  • Loading branch information
lippserd committed Aug 13, 2015
1 parent d4a7d05 commit 5a290cc
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions app/modules/Cronks/lib/js/Icinga/Cronks/util/FilterState.js
Expand Up @@ -22,32 +22,36 @@

/*jshint browser:true, curly:false */
/*global Ext:true */
(function() {
"use strict";
Ext.ns("Icinga.Cronks.util").FilterState = Ext.extend(Ext.util.Observable,{
(function () {
'use strict';

constructor: function(cfg) {
this.grid = cfg.grid;
Ext.ns('Icinga.Cronks.util').FilterState = Ext.extend(Ext.util.Observable, {

constructor: function (cfg) {
this.grid = cfg.grid;
this.tree = cfg.tree;
Ext.util.Observable.prototype.constructor.apply(this,arguments);
this.tree.on("filterchanged",this.applyFilterToGrid,this);
Ext.util.Observable.prototype.constructor.apply(this, arguments);
this.tree.on('filterchanged', this.applyFilterToGrid, this);
},

update: function(filter) {
update: function (filter) {
this.tree.setLastState(filter);
this.grid.getStore().setBaseParam("filter_json", Ext.encode(filter));
this.grid.getStore().setBaseParam('filter_json', Ext.encode(filter));
},

applyFilterToGrid: function(filter) {
applyFilterToGrid: function (filter) {
console.log("applyFilterToGrid");
var store = this.grid.getStore();
if(filter)
store.setBaseParam("filter_json", Ext.encode(filter));
else
if (filter) {
store.setBaseParam('filter_json', Ext.encode(filter));
} else {
delete store.baseParams.filter_json;
store.reload();
}
var params = {};
params[store.paramNames.start] = 0;
store.reload({
params: params
});
}

});

})();

0 comments on commit 5a290cc

Please sign in to comment.