PDA

View Full Version : Store Reload



dirkpitt_10
6 Nov 2009, 8:16 AM
Hi, i can't reload my store object
i now exists many post about this argument but i have even the problem :(

this is my code




this.store = new Ext.data.JsonStore({
url: url,
root: 'images',
fields: [
'name', 'url',
{name:'size', type: 'float'},
{name:'lastmod', type:'date', dateFormat:'timestamp'}
],
listeners: {
'load': {fn:function(){ this.view.select(0); }, scope:this, single:true}
}
});
this.store.load();

........
.......

this.store.reload({
params: Ext.apply({
url: obj.attributes.url,
root: 'images',
fields: [
'name', 'url',
{name:'size', type: 'float'},
{name:'lastmod', type:'date', dateFormat:'timestamp'}
],
listeners: {
'load': {fn:function(){ this.view.select(0); }, scope:this, single:true}
}
},
this.store.lastOptions
)}
);


some help? Tanks

Stefano

NoahK17
6 Nov 2009, 12:49 PM
To reload a store using the same params that were sent previously...


storename.store.reload();

Alternatively, you can send in new params using this method...


storename.store.load({params:{new_param: 123}});

Condor
6 Nov 2009, 11:26 PM
params are not config options.

You can't change the proxy and reader config options by specifying them as params. Params are the parameters that are send with the request (e.g. GET query or POST data).

HttpProxy as a setUrl method to change the url, but if you want to change anything else you'll have to create a new store.
Most components have a bindStore or reconfigure method to change the store.

dirkpitt_10
9 Nov 2009, 2:32 AM
Hi Condor, i solved in this way:




changeDir: function(url){
this.store.proxy.conn.url = url;
this.store.reload();
},

loadStore: function(url){

this.store = new Ext.data.JsonStore({
url: url,
root: 'images',
fields: [
'name', 'url',
{name:'size', type: 'float'},
{name:'lastmod', type:'date', dateFormat:'timestamp'}
],
listeners: {
'load': {fn:function(){ this.view.select(0); }, scope:this, single:true}
}
});
this.store.load();
},




Tanks for help.

Stefano

Condor
9 Nov 2009, 4:20 AM
Your code is correct for Ext 2.x, but in Ext 3 you should use:

this.store.proxy.setUrl(url);

dirkpitt_10
9 Nov 2009, 4:22 AM
Tank you Condor

Stefano