我有一个网格,其中一些列需要编辑。其中一列应通过下拉框进行编辑。下拉框存储是远程的,并且是键值对类型:
['id', 'title']
下拉框的valueField为id,displayValue为title。当编辑单元格时,我的下拉框会加载store,选择displayValue并返回valueField到网格编辑器。因此,单元格将填充valueField。
我的问题是:如何使单元格呈现displayValue?只是从store中选择它是不够的,因为渲染在store加载之前发生。目前我的代码(仅适用于本地存储):
{
header: 'Column title',
dataIndex: 'id',
displayField: 'title',
editor: {
xtype: 'combo',
valueField: 'id',
store: 'myStore',
displayField: 'title'
},
renderer: function(value) {
//How do I find the editors combobox store?
store = new myStore();
index = store.findExact('id', value);
if (index != -1) {
rs = store.getAt(index).data;
return rs.title;
}
return value;
}
}