Skip to content
Snippets Groups Projects
Commit f179fe04 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Introduce the Store.restoreWhere method.

parent 51101337
No related branches found
No related tags found
No related merge requests found
......@@ -88,31 +88,21 @@ App.grid.Grid = Ext.extend(Ext.grid.GridPanel, {
var action,
i;
// private function to emitt the resetgrid event
// private function to emit the resetgrid event
function fireReset() {
this.fireEvent('resetgrid');
}
// parameters for the store load action
// parameters defining the store load action
action = {callback: fireReset, scope: this};
if (this.getBottomToolbar() instanceof Ext.PagingToolbar) {
action.params = {start: 0, limit: this.nRows};
}
// restore initial where condition of the store
// in order to remove filter condition
if ('where' in this.store.baseParams) {
if (this.store.initialWhere) {
this.store.baseParams.where = [];
for (i = 0; i < this.store.initialWhere.length; i += 1) {
this.store.baseParams.where.push(this.store.initialWhere[i]);
}
} else {
delete this.store.baseParams.where;
}
}
// in order to remove remote filter condition
this.store.restoreWhere();
// reload the store and fire the resetgrid event
this.store.load(action);
}
......
......@@ -115,6 +115,28 @@ App.data.DirectStore = Ext.extend(Ext.data.DirectStore, {
store.totalLength -= 1;
break;
}
},
/**
* Restore the where conditions to the original values.
* Useful to remove remote filter condition.
*/
restoreWhere: function () {
var i;
if ('where' in this.baseParams) {
if (this.initialWhere) {
this.baseParams.where = [];
for (i = 0; i < this.initialWhere.length; i += 1) {
this.baseParams.where.push(this.initialWhere[i]);
}
} else {
delete this.baseParams.where;
}
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment