4
votes

I got a extjs 4 combobox within a form bound to a model. I am binding data from grid to combo using form.loadRecord(record). The combobox is showing the valueField coming from the model assigned to the form instead of the displayField. The store of the combobox is preloaded. How can I achieve that the combobox shows the displayValue loading a record in the form?

        {xtype:'combobox',
        fieldLabel: 'category',
        name: 'categorySelId',
        store: 'Categories',
        queryMode: 'local',
        displayField: 'label',
        valueField: 'id',
        anchor:'96%',
        loadMask: true,
        typeAhead: true,
        forceselection: true,
        valueNotFoundText: 'Nothing found'}

The store is already used in the grid to show the column category

        { header: 'Category', dataIndex: 'categorySelectedId', flex:5,
            renderer: function(value,metaData,record) {
                if(value) {
                    var Categories = Ext.getStore('Categories');
                    var catRecord = Categories.findRecord('id', value);
                    return catRecord ? catRecord.get('label'): record.get('categorySelected');
                } else return "";
            }
        },

Thx for your help!

1
Are you sure the store is loaded before you load the record to the combobox?sha
Yes, I'm sure. I'm using it already in the grid column renderer to show the category label. See source edited postManuel
That doesn't prove anything actually. What is the relationship between your grid and a form with combo?sha
grid on douple click handler: ... var selection = this.getArticleList().getSelectionModel().getSelection()[0]; theForm.loadRecord(selection); ...Manuel

1 Answers

5
votes

The problem was that I have not had configured the correct types in the model. Setting the right type in the model solved the problem. Thx sha for helping!