所有字段在组合框中都是“未定义的”

时间:2011-02-18 13:55:55

标签: extjs combobox

我的组合框字段有点问题。一切都未定义。

buildMyCombo : function(label)
{
    var store = new Ext.data.ArrayStore({
        fields: ['name', 'value'],
        data :  [
            ['.xls', 1],
            ['.csv', 2],
            ['.htm', 3]
        ]
    });

    var result = new BGGNE.components.fields.SimpleComboBox({
        formFields: {},
        enableKeyEvents: true,
        store: store,
        valueField: 'value',
        displayField: 'name',
        lazyInit:false,
        formFieldDefinition: {
            isMandatory: true,
            fieldLabel: label,
            hideTrigger: false,
            selectOnFocus: true,
            isEditableInDialog: false,
            type: {
                kind: 'local',
                type: 'Text',
                selectableValues: 'name'
            },
            renderAsExtField: true,
            isOnAPropagation: true,
            forceSelection: true
        }
    });
    result.on('focus', function ()
    {
        result.doQuery('', true);
    }, this);
    result.on('select', this.onComboSelect, this);

    return result;
},

所以,我应该看到商店中的3件商品,而我只看到3件商品'undefined'。所以,我相信组合框会读取商店,因为它知道我在那里有多少商品。但由于某些原因,显示了未定义的文本。

1 个答案:

答案 0 :(得分:0)

我设法自己解决问题。问题是我需要把这段代码

store: store,
valueField: 'value',
displayField: 'name',

在formFieldDefinition中。虽然SimpleComboBox扩展了ComboBox,但是一些代码被覆盖,而formFieldDefinition是定义列表项的字段。

如果这个问题浪费你的时间,请致谢并道歉。