开发者

All fields are "undefined" in a combobox

开发者 https://www.devze.com 2023-02-11 16:47 出处:网络
have a little problem with my combo box fields. All are undefined. buildMyCombo : function(label) { var store = new Ext.data.ArrayStore({

have a little problem with my combo box fields. All are undefined.

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

    var result = new BGGNE.components.fie开发者_开发知识库lds.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;
},

So, I should see the 3 items from store, instead I see only 3 items 'undefined'. So, I believe that the combo box reads the store cause it knows how many items I do have there. but because of something the undefined text is displayed.


I manage to solve the problem myself. The problem was that I needed to put this code

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

in the formFieldDefinition. While SimpleComboBox extends ComboBox some code was overridden and the formFieldDefinition is the field that defines the list items.

Thanks and apologize if the question was a waste of your time.

0

精彩评论

暂无评论...
验证码 换一张
取 消