我的网格有动态列。当用户点击此列时,它会显示商店返回的值列表。一旦用户选择任何值,我希望显示字段显示该值,而不是该值的数字ID(键)。
.....................
......................
plugins : [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
pluginId: 'Editor',
listeners : {
delay:1,
scope: this
}
})
],
doAfterFilterRendered : function() {
for (var i = 0; i <Ext.getCmp('ReportGrid').gridColumns.length; i++) {
if (ColumnGridType == 'COMBOBOX')// base on some condition i m trying to create combo box
{
Ext.getCmp('ReportGrid').gridColumns[i].editor= {
xtype: 'combobox',
forceSelection: true,
id : 'idCombo'
editable: false,
triggerAction: 'all',
allowBlank: false,
store: me.getColumnStoreList("Country")// which return 2 dimentional array with key value
}
}
}
Ext.getCmp('ReportGrid').getStore().load();
Ext.getCmp('ReportGrid').reconfigure(Ext.getCmp('ReportGrid').store, Ext.getCmp('ReportGrid').gridColumns);
},
......................
........................
我尝试按照事物显示值而不是键。
doAfterFilterRendered : function() {
for (var i = 0; i <Ext.getCmp('ReportGrid').gridColumns.length; i++) {
if (ColumnGridType == 'COMBOBOX')// base on some condition i m trying to create combo box
{
Ext.getCmp('ReportGrid').gridColumns[i].editor= {
xtype: 'combobox',
forceSelection: true,
id : 'idCombo'
editable: false,
triggerAction: 'all',
allowBlank: false,
store: me.getColumnStoreList("Country") // which return 2 dimentional array with key value,
**fields: ['key', 'value']}),
valueField: 'key',
displayField: 'value',**
}
}
}
答案 0 :(得分:0)
您需要在列网格中添加渲染器: 像这样的东西
renderer: function(val){
index = me.getColumnStoreList("Country").findExact('key',val);
if (index != -1){
rs = me.getColumnStoreList("Country").getAt(index).data;
return rs.value;
}
},