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
Printable View
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
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?
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));
}
});
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!
So, where's your code that's going wrong?
Code:{
text: 'Reset',
handler: function(){
gridstore.baseParams = {};
grid.getSelectionModel().clearSelections();
gridstore.reload();
}
}
reload.
You are asking it to reload
Not to load.
http://extjs.com/deploy/dev/docs/?cl...&member=reloadQuote:
Originally Posted by TFM"
that did it. Thanks! I appreciate your help.
Marty