Noel Chung
Noel Chung

Reputation: 75

replace url of Ext.data.store

I have StoreBaseOn declared, and I want to change the URL of it and then load it, as my code need to do so. How to change the URL?

declared code:

StoreBaseOn =  new Ext.data.JsonStore({
    url: [myurl],
    root: 'rows',
    idProperty: [myID],
    autoLoad: true,
    remoteSort: true,
    baseParams: [myParam],
    fields: ['id', 'age']
});

I know how to change param e.g. StoreBaseOn.setBaseParam('group', the_group); But how to just change the URL?

Upvotes: 2

Views: 107

Answers (2)

Todayboy
Todayboy

Reputation: 355

Thanks Ludovic! sadly I use ExtJS3.4 and which does not have getProxy() method yet. However, by your inspiration, I figured out how to do in my case:

StoreBaseOn.proxy.setUrl(myNewUrl)

Upvotes: 1

Ludovic Feltz
Ludovic Feltz

Reputation: 11916

The url is setted in the proxy of your store so you can use the following function to set it:

StoreBaseOn.getProxy().setUrl("YouNewUrl");

Upvotes: 2

Related Questions