ExtJS 4 combobox shows valueField instead of displayField on form bind

11,098

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!

Share:
11,098
Manuel
Author by

Manuel

Hi there, I'm a Digital & Technology Evangelist! I helps customers to evolve ideas to business models and solutions and realizes them. My strength? I combine business knowledge, a growth & lean startup mindset, coaching and methodology like design thinking, business model canvas (bmc) value proposition design (vpd) with latest state of the art technologies. Technologie vise I focuse on cloud, aws serverless, progressive web applications (pwa) and augmented reality (ar/mr). Currently I'm working as a consultant at OPITZ CONSULTING. Having the OC|Lab in my background I can offer companies a lab and innovation space to realize and test new ideas!

Updated on June 04, 2022

Comments

  • Manuel
    Manuel almost 2 years

    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!

  • digz6666
    digz6666 over 11 years
    How did you configured the type?
  • Manuel
    Manuel over 11 years
    I just have not had any type defined. As soon as I defined it as text it worked.