可编辑网格中的ComboBox:看不到值 [英] ComboBox in editable grid: can't see the value
本文介绍了可编辑网格中的ComboBox:看不到值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的网格商店:
new Ext.data.Store({....
proxy:new Ext.data.HttpProxy ...
reader:new Ext.data.JsonReader({
root:'rows',
fields:[... .. {name:'wid',mapping:'wid'},
在我的列模型中:
header:'
dataIndex:'wid',
编辑器:新的Ext.grid.GridEditor(workerCmb),
renderer:function(value,p,record){
return record .data ['name'];}
组合本身:
valueField:'wid',
displayField:'name',
当网格加载它的字段工人是空的(这是可以的),但没有组合框,当我开始编辑它,我看到所有的列表。编辑'id'后我s保存到商店,但名称未显示,也不是组合框。
我做错了什么?
解决方案
这有助于:
Ext.util.Format.comboRenderer = function(combo){
return function(value){
var record = combo.findRecord(combo.valueField | | combo.displayField,value);
返回记录? record.get(combo.displayField):combo.valueNotFoundText;
}
}
I have an editable grid that uses a store. I want to insert a combobox in one of the fields. This is my store for the grid:
new Ext.data.Store({ ....
proxy: new Ext.data.HttpProxy......
reader: new Ext.data.JsonReader({
root: 'rows',
fields: [..... {name:'wid', mapping: 'wid'},
There is another store for combobox only, which has 'wid' and 'name' fields. In my column model:
header: 'Worker',
dataIndex: 'wid',
editor: new Ext.grid.GridEditor(workerCmb),
renderer:function(value, p, record){
return record.data['name'];}
And the combo itself:
valueField: 'wid',
displayField: 'name',
When the grid is loaded its field "Worker" is empty (it is ok), but there is no combobox in it. When I start editing it, I see all the list. After editing the 'id' is saved to the store, but the 'name' is not shown, neither is the combobox. What am I doing wrong?
解决方案
this helped:
Ext.util.Format.comboRenderer = function(combo){
return function(value){
var record = combo.findRecord(combo.valueField || combo.displayField, value);
return record ? record.get(combo.displayField) : combo.valueNotFoundText;
}
}
这篇关于可编辑网格中的ComboBox:看不到值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文