使用 Extjs-6 的 propertygrid 中的组合框
combobox in propertygrid using Extjs-6
我正在使用 Extjs-6. I have propertygrid
. One of this propertygrid
'row is a combobox
. valueFiled
property of combobox
is id
and displayfield
is name
. When I want to edit the combobox
in propertygrid
it show the names, but when the propertygrid
is not in edit mode, it show the id
. I want to show in 2 modes name
value, and its value be id
. My sampleCode is here。
可以吗? 我该怎么做?
如@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");
}
}
}
}]
});
我正在使用 Extjs-6. I have propertygrid
. One of this propertygrid
'row is a combobox
. valueFiled
property of combobox
is id
and displayfield
is name
. When I want to edit the combobox
in propertygrid
it show the names, but when the propertygrid
is not in edit mode, it show the id
. I want to show in 2 modes name
value, and its value be id
. My sampleCode is here。
可以吗? 我该怎么做?
如@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");
}
}
}
}]
});