我是 Sencha Touch2 的新手,我试图通过从一个简单的商店加载任意数据来启动我的应用程序,然后再继续使用代理。我的视图显示但数据未填充。我见过这个问题,但没有任何帮助我解决的问题。感谢任何帮助和耐心。提前感谢!
我的模特
Ext.define('SenchaFirstApp.model.Distributors', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 't', type: 'string'},
{name: 'distr', type: 'string'},
{name: 'group', type: 'string'},
{name: 'site', type: 'string'},
{name: 'status', type: 'string'},
{name: 'actuve', type: 'string'},
{name: 'assigned', type: 'string'},
{name: 'state', type: 'string'},
{name: 'schedule', type: 'string'},
{name: 'finished', type: 'string'} ],
}
});
我的观点
var distrStore = Ext.create('SenchaFirstApp.store.DistributorStore');
Ext.define('SenchaFirstApp.view.DistributorView', {
extend: 'Ext.dataview.DataView',
requires: [distrStore, 'Ext.data.Store', 'Ext.dataview.List'],
model: 'SenchaFirstApp.model.Distributors',
xtype: 'mainlist',
fullscreen: true,
config:
{
fullscreen: true,
layout: 'fit',
border: 5,
title: 'Distributors',
html: 'My datalist',
autoLoad: true,
items:{
title: 'Setup',
xtype:'list',
store: distrStore,
fields: [
{
text: 'T',
width: 1,
sortable: false,
hideable: false,
dataIndex: 't'
},
{
text: 'Distributor',
width: 50,
sortable: false,
hideable: false,
dataIndex: 'distr'
},
{
text: 'Group',
width: 20,
sortable: false,
hideable: false,
dataIndex: 'group'
},
{
text: 'Site Name',
width: 20,
sortable: false,
hideable: false,
dataIndex: 't'
},
{
text: 'Status',
width: 5,
sortable: false,
hideable: false,
dataIndex: 'status'
},
{
text: 'Active',
width: 5,
sortable: false,
hideable: false,
dataIndex: 'active'
},
{
text: 'State',
width: 2,
sortable: false,
hideable: false,
dataIndex: 'state'
},
{
text: 'Scheduled',
width: 10,
sortable: false,
hideable: false,
dataIndex: 'schedule'
},
{
text: 'Finished',
width: 10,
sortable: false,
hideable: false,
dataIndex: 'finished'
}
]
}
}
});
distrStore.load();
我的商店
Ext.define('SenchaFirstApp.store.DistributorStore', {
extend: 'Ext.data.Store',
requires: ['SenchaFirstApp.model.Distributors', 'Ext.dataview.DataView'],
config: {
// xtype: 'distrlist',
storeId: 'mainlist',
model: 'SenchaFirstApp.model.Distributors',
autoLoad: true,
data: [
{t: 'S', distr: 'Smart Systems', site: 'Smart Temps', status: "done", active: 'Yes', assigned: 'Me', state: 'IN', schedule: 'today', finished: 'today'},
{t: 'I', distr: 'People', site: 'This One', status: "done", active: 'Yes', assigned: 'You', state: 'NC', schedule: 'yesterday', finished: 'tomorrow'}
]}});
应用程序.js
Ext.Loader.setConfig({enabled:true});
Ext.application({
name: 'SenchaFirstApp',
stores: ['DistributorStore'],
models: ['Distributors'],
views: ['DistributorView'],
requires: ['SenchaFirstApp.view.DistributorView', 'Ext.dataview.DataView', 'SenchaFirstApp.model.Distributors', 'SenchaFirstApp.store.DistributorStore', 'Ext.dataview.List'],
launch: function() {
Ext.fly('appLoadingIndicator');
Ext.Viewport.add(Ext.create('SenchaFirstApp.view.DistributorView'));
}
});