在我的extjs FormPanel中,我有几个编辑器网格。我不知道这些网格的I是什么,所以我不能使用Ext.getCmp。
“获取此FormPanel中的所有editorgrid类型”的最佳方式是什么?
发布于 2009-11-12 04:57:58
可以使用isXType按每一项的类型筛选FormPanel的items集合
var grids = formPanel.items.filterBy(function (item) {
return item.isXType("editorgrid");
});grids将是所有EditorGridPanel项的新集合。
更新:更简洁的方式:
var grids = formPanel.findByType("editorgrid", true);发布于 2009-11-18 03:18:31
尽管我们避免对DOM ID进行硬编码,但拥有可用的组件ID会很方便。
this.gridOneId = Ext.id( null, 'gridOne' ); // guaranteed unique
new Ext.grid.GridPanel({
id: this.gridOneId,
store: storeOne,
columns: columnsOne,
title: 'Grid One',... });
this.gridTwoId = Ext.id( null, 'gridTwo' ); // guaranteed unique
new Ext.grid.GridPanel({
id: this.gridTwoId,
store: storeTwo,
columns: columnsTwo,
title: 'Grid Two',... });
https://stackoverflow.com/questions/1717937
复制相似问题