【发布时间】:2023-03-28 20:15:01
【问题描述】:
我正在使用 MVC 架构将数据加载到列表中,并将其显示在屏幕上。 运行应用程序时出现以下错误
[WARN][test.view.list#applyStore] 找不到指定的Store
我尝试按照here 给出的说明进行操作,但它给了我错误:
在 null/view/list.js 处找不到文件 null/store/list1store.js null/model/list1modeljs
应用程序的根目录是“test”。
列出模型文件:
Ext.define('test.model.list1model', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'},
{name: 'age', type: 'int'},
{name: 'eyeColor', type: 'string'}
]
}
});
列出存储文件:
Ext.define("test.store.list1store", {
extend:'Ext.data.Store',
requires:['test.model.list1model'],
config:{
model: "test.store.list1model",
data : [
{firstName: "Ed", lastName: "Spencer"},
{firstName: "Tommy", lastName: "Maintz"},
{firstName: "Aaron", lastName: "Conran"},
{firstName: "Jamie", lastName: "Avins"}
]
}
});
列表视图文件:
Ext.define("test.view.list", {
extend:'Ext.List',
requires:['test.store.list1store'],
config:{fullscreen: true,
store: 'test.store.list1store',
itemTpl: "{lastName}, {firstName}"
}
});
app.js:
Ext.application({
requires: [
'Ext.dataview.List',
'Ext.Panel',
'Ext.Spacer',
'test.view.list',
'Ext.List',
'test.model.list1model',
'test.store.list1store'
],
launch : function(){
list1 =Ext.create('test.view.list');
Ext.create('Ext.Container',{
id:'contain',
fullscreen:true,
items:[
list1,
]
})
}
});
【问题讨论】:
标签: list extjs model-view-controller store