-2

combo.setvalue(id) called in beforeedit function show display values while editing in 4.2 but in 6.2 it is showing empty.

combo.getStore().load();
combo.getStore().on('load', function(){combo.setvalue(id)})

is working in 6.2 but taking time after row is ready to edit.

1 Answers1

0

try to use this, stores changed really hard from 4.2 to 6.2, maybe your load finish before the onload listener is setted.

combo.getStore().load(function(){
   combo.setValue(id);
});

also comboboxes should be setted by valuefield, so read on your combo configs if that is setted properly. If you don't have to use valuefield you can use

combo.setRawValue(id);

More specified example

    // The data store containing the list of states
var states = Ext.create('Ext.data.Store', {
    fields: ['abbr', 'name'],
    data : [
        {"abbr":"AL", "name":"Alabama"},
        {"abbr":"AK", "name":"Alaska"},
        {"abbr":"AZ", "name":"Arizona"}
    ]
});

// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox', {
    fieldLabel: 'Choose State',
    store: states,
    queryMode: 'local',
    displayField: 'name',
    valueField: 'abbr',
    listeners:{
      render: function(combo){
          combo.setValue('AL');
      }  
    },
    renderTo: Ext.getBody()
});
LellisMoon
  • 4,810
  • 2
  • 12
  • 24