Sencha Touch 复杂 store

 Ext.define('Contact.model.Titles', { extend: 'Ext.data.Model', config: { fields: [ { name: 'itemTitle',type: 'string'}, { name: 'itemValue',type: 'string'}, ], belongsTo: 'Agency' } });

 Ext.define('Contact.model.Agency', { extend: 'Ext.data.Model', config: { fields: [ { name: 'agencyId',type: 'string'}, { name: 'agencyId',type: 'string'}, { name: 'state',type: 'string'}, {name: 'titleList'} ], hasMany : {model: 'Titles', name: 'titleList'} } }); 

Ext.define('Contact.store.Agency', { extend: 'Ext.data.Store', requires:['Contact.model.Agency'], config: { model: 'Contact.model.Agency', data: [ { "titleList": [ { "itemValue": "王晓亮", "itemTitle": "发起人" }, { "itemValue": "201202235", "itemTitle": "工单编号" }, { "itemValue": "SWX--TEST", "itemTitle": "工单说明" }, { "itemValue": "王晓亮", "itemTitle": "上次任务处理人" }, { "itemValue": "2013-05-29 16:09:53", "itemTitle": "上次办理时间" } ], "state": "3", "agencyId": "2029636", "flowId": "1860857" }]} }) 

Ext.define('Contact.view.AgencyList', { extend: 'Ext.dataview.List', id:'agencylistview', config: { title:'采购事项审批', pageNo:1, pageSize:10, totalpages:0, store:'Agency', itemTpl:new Ext.XTemplate('{agencyId}, {itemTitle}', { test:function(list) { return list[0].itemTitle; }, }), }, });

如果对你有帮助 可以捐助我呀!大老板们 



你可能感兴趣的:(Sencha Touch,touch,sencha,ext4,阿赛)