我想在我的列表中加载静态数据,但是当我在app.js中声明时:
stores:['Search'],
我在Chorme上得到了这个错误:
未捕获错误:[Ext.Loader]无法加载'../touch/src/data/Search.js',请验证该文件是否存在
我不知道为什么chrome尝试加载本地文件而它们没有任何作用......
模型/ Search.js
Ext.define('bolao.model.Search', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'}
]
}
});
存储/ Search.js
Ext.define('bolao.store.Search', {
extend: 'Ext.data.Search',
requires : [ 'bolao.model.Search' ],
config: {
storeId : 'Search',
model: 'bolao.model.Search',
data:[
{ firstName: 'Tommy', lastName: 'Maintz' },
{ firstName: 'Rob', lastName: 'Dougan' },
{ firstName: 'Ed', lastName: 'Avins' } ]
}
});
我的清单:
xtype: 'list',
ui: 'round',
pinHeaders: false,
itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
Store: 'Search',
emptyText: '<div style="margin-top: 20px; text-align: center">No Matching Items</div>',
disableSelection: true
答案 0 :(得分:1)
更改您的商店,如下所示
Ext.define('bolao.store.Search', {
extend: 'Ext.data.Store',
requires : [ 'bolao.model.Search' ],
config: {
storeId : 'Search',
model: 'bolao.model.Search',
data:[
{ firstName: 'Tommy', lastName: 'Maintz' },
{ firstName: 'Rob', lastName: 'Dougan' },
{ firstName: 'Ed', lastName: 'Avins' } ]
}
});