-
20 Feb 2009 8:07 AM #1
clearing baseParams?
clearing baseParams?
How can I clear or remove baseParams?
gridstore.baseParams = {}; doesn't seem to work. For now we are loopinhg thru them all and setting them to empty. Is there a method for this?
Thanks, Marty
-
20 Feb 2009 8:17 AM #2
It could be a problem of the Store class corrupting the config object which you pass to load or reload.
It actually mutates any params object that you have in a config which you pass to load or reload.
How is your code using these methods?Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
20 Feb 2009 8:23 AM #3
The code has
Try an overrideCode:load : function(options){ options = options || {}; if(this.fireEvent("beforeload", this, options) !== false){ this.storeOptions(options); var p = Ext.apply(options.params || {}, this.baseParams); if(this.sortInfo && this.remoteSort){ var pn = this.paramNames; p[pn["sort"]] = this.sortInfo.field; p[pn["dir"]] = this.sortInfo.direction; } this.proxy.load(p, this.reader, this.loadRecords, this, options); return true; } else { return false; } }, /** * <p>Reloads the Record cache from the configured Proxy using the configured Reader and * the options from the last load operation performed.</p> * <p><b>It is important to note that for remote data sources, loading is asynchronous, * and this call will return before the new data has been loaded. Perform any post-processing * in a callback function, or in a "load" event handler.</b></p> * @param {Object} options (optional) An object containing loading options which may override the options * used in the last load operation. See {@link #load} for details (defaults to null, in which case * the most recently used options are reused). */ reload : function(options){ this.load(Ext.applyIf(options||{}, this.lastOptions)); },
Code:Ext.override(Ext.data.Store, { load : function(options){ // Use a copy of what the caller passed options = Ext.apply({}, options); if(this.fireEvent("beforeload", this, options) !== false){ this.storeOptions(options); var p = Ext.apply(options.params || {}, this.baseParams); if(this.sortInfo && this.remoteSort){ var pn = this.paramNames; p[pn["sort"]] = this.sortInfo.field; p[pn["dir"]] = this.sortInfo.direction; } this.proxy.load(p, this.reader, this.loadRecords, this, options); return true; } else { return false; } }, /** * <p>Reloads the Record cache from the configured Proxy using the configured Reader and * the options from the last load operation performed.</p> * <p><b>It is important to note that for remote data sources, loading is asynchronous, * and this call will return before the new data has been loaded. Perform any post-processing * in a callback function, or in a "load" event handler.</b></p> * @param {Object} options (optional) An object containing loading options which may override the options * used in the last load operation. See {@link #load} for details (defaults to null, in which case * the most recently used options are reused). */ reload : function(options){ // Use a copy of what the caller passed options = Ext.apply({}, options); this.load(Ext.applyIf(options, this.lastOptions)); } });Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
20 Feb 2009 8:41 AM #4
Thanks. I am just setting the baseParams on the store and then loading the grid. I have a search form that I use to set new baseParams. I need a way to clear them to reset the grid. Seems your code works fine to clear the baseParams but the original params are still getting posted to the page along with start and limit.
Any way to remove them from the post?
Thanks, Marty
Also, thanks for the fast reply!
-
20 Feb 2009 8:51 AM #5
So, where's your code that's going wrong?
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
20 Feb 2009 8:53 AM #6
Code:{ text: 'Reset', handler: function(){ gridstore.baseParams = {}; grid.getSelectionModel().clearSelections(); gridstore.reload(); } }
-
20 Feb 2009 8:53 AM #7
reload.
You are asking it to reload
Not to load.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
20 Feb 2009 8:55 AM #8
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
20 Feb 2009 9:02 AM #9
that did it. Thanks! I appreciate your help.
Marty


Reply With Quote