我有一个弹出窗口,它有一些xtype,一个xtype是一个网格,它有一个Store,但我没有看到它调用任何ajax调用。谁能告诉我我错过了什么?
Ext.define('myApp.view.myPopup' {...
....
{
xtype: 'grid',
store: 'MyStore',
iconCls: 'x-fa fa-users',
height : 450,
columns: [{
header...
...}商店
Ext.define('myApp.store.MyStore', {
extend: 'Ext.data.Store',
model: 'myApp.model.modelA',
pageSize: 100,
remoteSort: true,
autoload : true,
proxy: {
type: 'ajax',
url : 'getStatusId',
reader: {
type: 'json',
root: 'rows',
successproperty: 'status',
totalProperty: 'records'
}
},
listeners : {
beforeload : function(store, operation, eOpts) {
...
store.getProxy().extraParams = submitParams;
}
}
});发布于 2018-01-28 12:50:32
你有一个拼写错误:autoload -> autoLoad。
您的代码也没有显示正在创建的存储的实例。store: 'MyStore'需要具有storeId: 'MyStore'的现有存储实例。
你可能想要更像这样的东西:
Ext.define('myApp.view.myPopup' {...
....
{
xtype: 'grid',
store: { type: 'myStore' },
iconCls: 'x-fa fa-users',
height : 450,
columns: [{
header...
...}
Ext.define('myApp.store.MyStore', {
extend: 'Ext.data.Store',
alias: 'store.myStore',
model: 'myApp.model.modelA',
// ....
});发布于 2018-01-29 16:09:18
创建一个store实例并指向它。
var store = Ext.create('myApp.store.MyStore' {
autoLoad : true,
});
..........
{ xtype: 'grid',
store: store,
iconCls: 'x-fa fa-users',
height : 450,
}发布于 2018-01-29 23:06:28
就像@evan-trimboli声明的那样,你要么必须使用一个激活式存储实例,要么可以使用一个配置。然后,该配置将引导您在内部创建一个新的存储实例。
要使用配置动态创建存储实例,您需要在存储类上提供一个别名,例如alias: "store.mystore"。现在,您可以在网格类的存储配置中引用它,如store: { type: 'myStore' }。
把所有这些都放在下面,也可以看看a running fiddle。
Ext.define('myApp.store.MyStore', {
extend: 'Ext.data.Store',
alias: 'store.mystore', // the alias we need for the store config of the grid
// ...
});
Ext.define('myApp.view.myPopup', {
extend: 'Ext.grid.Panel',
store: {
type: 'mystore' // references the store by it's alias
},
// ...
};https://stackoverflow.com/questions/48483136
复制相似问题