在我的extjs FormPanel
中,我有幾個編輯器網格。我不知道這些網格的ID是什麼,所以我不能使用Ext.getCmp
。在FormPanel中獲取子editorGrid類型
什麼是最好的方式來說'獲取所有editorgrid
類型在這FormPanel
'?
在我的extjs FormPanel
中,我有幾個編輯器網格。我不知道這些網格的ID是什麼,所以我不能使用Ext.getCmp
。在FormPanel中獲取子editorGrid類型
什麼是最好的方式來說'獲取所有editorgrid
類型在這FormPanel
'?
您可以通過每個項目的類型,通過使用isXType
過濾items
收集FormPanel中的:
var grids = formPanel.items.filterBy(function (item) {
return item.isXType("editorgrid");
});
grids
將所有EditorGridPanel
項目的新的集合。
更新:一個更簡潔的方式:
var grids = formPanel.findByType("editorgrid", true);
雖然我們避免硬編碼DOM的ID,其可用都能得心應手組件ID。
... });
this.gridTwoId = Ext.id(null, 'gridTwo'); // guaranteed unique
new Ext.grid.GridPanel({
id: this.gridTwoId,
store: storeTwo,
columns: columnsTwo,
title: 'Grid Two',
... });
完美的作品。謝謝! – 29er 2009-11-12 04:57:17