diff --git a/static/plugin_dbui/src/jsonstore.js b/static/plugin_dbui/src/jsonstore.js index 9ab340fc3bbdf93929c7b94e0a7085b1cb70ec31..0a70891f0a6da01e6f55f913589221030d6f7070 100644 --- a/static/plugin_dbui/src/jsonstore.js +++ b/static/plugin_dbui/src/jsonstore.js @@ -41,14 +41,23 @@ App.data.DirectStore = Ext.extend(Ext.data.DirectStore, { */ autoLoad: true, autoSave: true, - + + /** + * private parameter + * List of the where condition at startup. + * It is a copy of the baseParams.where which can be modified by filter. + * The intialWhere configuration parameter can be used reseting filter + */ + initialWhere: undefined, + /** * constructor */ constructor: function (config) { var cfg, - cfgWrt; + cfgWrt, + i; // configuration option with default value for // the Ext.data.JsonWriter. Changing these options might break @@ -74,6 +83,14 @@ App.data.DirectStore = Ext.extend(Ext.data.DirectStore, { cfgWrt = Ext.copyTo({}, cfg, 'encode, listful, writeAllFields'); cfg.writer = new Ext.data.JsonWriter(cfgWrt); } + + // keep a copy of the initial where condition + if ('where' in cfg.baseParams) { + cfg.initialWhere = []; + for (i = 0; i < cfg.baseParams.where.length; i += 1) { + cfg.initialWhere.push(cfg.baseParams.where[i]); + } + } // instantiate the store App.data.DirectStore.superclass.constructor.call(this, cfg);