我正在使用Extjs-6。我有propertygrid
。其中一个propertygrid
'行是combobox
。 valueFiled
的{{1}}属性为combobox
,id
为displayfield
。如果我要在name
中修改combobox
,则会显示名称,但当propertygrid
未处于编辑模式时,会显示propertygrid
。我希望以2种模式显示id
值,其值为name
。我的sampleCode是here。
可能吗? 我该怎么做?
答案 0 :(得分:1)
如上所述@CD,您应该使用渲染器:
Ext.define('Fiddle.Main', {
extend: 'Ext.panel.Panel',
width: 400,
height: 200,
title: 'Its me!',
items: [{
xtype: 'propertygrid',
width: 400,
layout: 'fit',
source: {
ali: 3
},
sourceConfig: {
ali: {
displayName: 'ali',
editor: {
xtype: 'combobox',
store: store,
displayField: 'name',
valueField: 'id'
},
renderer: function(v){
return store.findRecord("id", v).get("name");
}
}
}
}]
});