简体   繁体   中英

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 eg StoreBaseOn.setBaseParam('group', the_group); But how to just change the URL?

网址是在商店的proxy中设置的,因此您可以使用以下功能进行设置:

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM