我正嘗試使用我的商店中填充的數據將一堆組件添加到我的容器中。我想遍歷我的商店記錄並輸出標籤/面板/等來顯示數據。EXT.JS循環訪問商店並在商品數組中生成組件
這是我如何通過循環現在:
initComponent: function() {
//Create a container for each array, then in that container,
//create a label and wrapping panel, then add the items to the wrapping panel
this.store = Ext.create('Ext.data.Store', {
model: 'MyProject.model.ItemArray',
data: []
});
Ext.apply(this, {
items: [
this.store.each(function() {
{
xtype:'label', text:
'test'
}
})
]
});
this.callParent(arguments);
}
當然但是,作爲ExtJS的小白,我,這是行不通的。我將不勝感激任何建議和最佳實踐提示,你可以提供這個工作。
我的模型ItemArray包含項目。我需要循環訪問我的ItemArrays存儲並創建容器,然後循環遍歷ItemArray中的Items,然後使用Items填充這些容器。
謝謝大家!
與作爲Ext noob無關,這只是無效的JS語法。 –