使用Extjs-6在propertygrid中组合框

时间:2015-12-17 07:18:00

标签: extjs combobox propertygrid extjs6

我正在使用Extjs-6。我有propertygrid。其中一个propertygrid'行是comboboxvalueFiled的{​​{1}}属性为comboboxiddisplayfield。如果我要在name中修改combobox,则会显示名称,但当propertygrid未处于编辑模式时,会显示propertygrid。我希望以2种模式显示id值,其值为name。我的sampleCode是here

可能吗? 我该怎么做

1 个答案:

答案 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");
            }
        }
    }
}]
});