【发布时间】:2012-07-10 08:04:54
【问题描述】:
我的模型上定义了一个代理。
我定义了一个指向模型的商店,没有代理,因为我希望它使用模型上定义的那个。
store.autoLoad: 真的不行
我必须从我的控制器显式调用
var store = this.getMyStore();
store.load();
这是预期的行为吗?
- 这不就是自动加载的目的吗?
- 是否只有在商店中定义了代理时才有效?
代码:
model/MyThing.js
Ext.define('MyApp.model.MyThing', {
extend: 'Ext.data.Model',
fields: ['id', 'reference'],
proxy:
{
type: 'ajax',
url: 'MyThings'
}
});
store/MyThings.js
Ext.define('MyApp.store.MyThings', {
extend: 'Ext.data.Store',
autoLoad: true,
autoSync: false,
model: 'MyApp.model.MyThing'
});
【问题讨论】:
-
确保您拥有
autoLoad而不是autoload。一旦你启动应用程序,它应该会自动加载商店。