0

是否可以更改分配给网格的 Store 的 url?我就是这样做的,但是看起来很丑。我相信还有另一种方法:

Ext.define('APP.controller.List', {
    extend : 'Ext.app.Controller',
    stores : ['Users', 'Reports'],
...
 // after click on some button
var lv = this.getUserlist();
lv.store.getProxy().api.read = 'data/reports.json'; // UGLY WAY to change url
lv.store.reload(); // and now my list has new content

In other way I have one list but I would like to load data there using 2 stores (users and reports). I know that store is assigned to list (grid) forever. 

How do it better without change url in store->proxy ?

Thanks for help.
4

1 回答 1

2

Use Store.setProxy() method instead:

var lv = this.getUserList();

lv.store.setProxy({
    type: 'ajax',
    url:  'data/reports.json'
});

I would also recommend to rethink your design if it calls for one Grid with two Stores. Something's wrong here.

于 2012-08-06T18:01:39.887 回答