我想用下面的数组变量填充列表数据我已经设置了这个数组来存储这里是数组内的记录类型列表
var logbookEntryList = [];
var aircraftMxLog = new AircraftMxLog(); //domian
aircraftMxLog.mxlogIdNum = mxLogIdNum;
aircraftMxLog.entryDatetime = entryDatetime;
aircraftMxLog.recordName = recordName;
aircraftMxLog.recordSourceId = recordSourceId;
logbookEntryList.push(aircraftMxLog);
var mxRelease = new MxRelease();
mxRelease.mxReleaseTypeId = mxReleaseTypeId;
mxRelease.entryDatetime = entryDatetime;
mxRelease.comments = comments;
mxRelease.firstName = firstName;
mxRelease.lastName = lastName;
logbookEntryList.push(mxRelease);
var flightLog = new FlightLog();
flightLog.flightNumId = flightNumId;
flightLog.arvStationId = arvStationId;
flightLog.deptStationId = deptStationId;
flightLog.outDate = outDate;
flightLog.offDate = offDate;
logbookEntryList.push(flightLog);
所以像这样我将在我的数组中有不同类型的数据所以我如何将它映射到我的模型以填充到列表视图中
我已经尝试通过每个函数迭代存储,我能够在迭代中获取每个元素对象,但是在动态迭代到列表时无法设置 itemtpl
这是代码
createViewFactory :function(){
var manageAmlStore=Ext.getStore('ManageAMLStore');
manageAmlStore.setData(logbookEntryList);
// this.getManageAmlStore().setData(logbookEntryList);
//
console.log('manage Aml store size '+manageAmlStore.getCount());
var manageAmlList=Ext.getCmp('manageAMlList')
manageAmlStore.each(function(item, index, length){
//console.info(item,length,index);
console.log('item '+item+' index '+index+' length '+length)
console.log('item size '+item.length)
if(logbookEntryList[index] instanceof AircraftMxLog){
manageAmlList.setItemTpl('AircraftMxLog'+index);
} else if(logbookEntryList[index] instanceof MxRelease){
manageAmlList.setItemTpl('MxRelease'+index);
// manageAmlList.initComponent();
//manageAmlList.render();
}else if(logbookEntryList[index] instanceof FlightLog){
manageAmlList.setItemTpl('FlightLog'+index);
}else if(logbookEntryList[index] instanceof MxAction){
manageAmlList.setItemTpl('MxAction'+index);
}
//Ext.getCmp('manageAMlList').setItemTpl('test'+id)
//this.getManageAmlList().setItemTpl('test'+id);
});
manageAmlList.bindStore(manageAmlStore);
}