【发布时间】:2014-11-06 04:33:42
【问题描述】:
我在 ext 3.4 中有一个网格,其中一列带有组合框编辑器。 {header: 'Facility', dataIndex: 'facility',editor: borrfacCombo}
网格的底层存储有 2 个字段(以及更多) - facility 和 facilityid
编辑器组合是从具有 id 和描述映射的商店加载的(类似于以下内容):
borrfacCombo=Ext.create('Ext.form.field.ComboBox',
{ displayField: 'name',
valueField: 'id',
store: {
fields: ['id', 'name'],
data: [
{id: 'scheme2', name: 'Green Envy'},
...
]
}
});
当在组合中选择特定的“设施”时 - 我需要在网格商店的选定行中填充相应的“设施 ID”。
我正在组合中的“选择”上尝试以下操作-
listeners:{
select:function(combo, record, index) {
var val=record.get('id');
var grid=combo.ownerCt.floatParent;
var selectedRecord = grid.getSelectionModel().getSelection()[0];
.... }
}
但“combo.ownerCt”总是显示为“未定义”。
我该如何解决这个问题?
【问题讨论】:
-
在没有看到您完整的组件层次结构的情况下,我们只能建议您在网格上设置一个 id 并使用
Ext.getCmp("yourGridId")。否则,以下之一也可以工作:combo.up('grid')(如果 combo 是网格的子项,例如因为它在网格的工具栏中),combo.up('panel').down('grid')(如果网格和组合在同一个面板中).. . -
Ext.getCmp 确实是我所做的。