replace url of Ext.data.store

replace url of Ext.data.store

本文关键字:data store Ext of url replace      更新时间:2023-09-26

我已经声明了StoreBaseOn,我想更改它的URL,然后加载它,因为我的代码需要这样做。如何更改URL?

声明代码:

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

我知道如何更改参数,例如StoreBaseOn.setBaseParam('group', the_group);但是如何更改URL呢?

url是在你的商店的proxy中设置的,所以你可以使用下面的函数来设置它:

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

谢谢Ludovic!遗憾的是,我使用ExtJS3.4,它还没有getProxy()方法。然而,在你的启发下,我想出了如何在我的情况下:

StoreBaseOn.proxy.setUrl(myNewUrl)