0
我想填充以下數組變量我已將此arrray在這裏保存列表數據動態填充列表視圖中的數據是記錄類型的數組如何senchatouch
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);
}
難道我的回答幫你出創建一個對象,方式
? – Fawar