1
votes

I am working with the Sencha EXT JS app on version 7.2 and we found the following scenario:

  • Click on the dropdown and select a value
  • Click "done"
  • Click on the dropdown and select another value
  • Click "cancel"
  • Click on the dropdown
  • Verify the invalid value selected

There is a sencha fiddle to help to reproduce this behavior:
https://fiddle.sencha.com/#view/editor&fiddle/3704

Thank you!

2

2 Answers

1
votes

Looks like to be standard feature (not a bug) ;) Anyway, to fix/change behavior for all the comboboxes use the following override:

Ext.define('overrides.field.ComboBox', {
    override: 'Ext.field.ComboBox',
    onExpandTap: function() {
        this.getPicker().setValue(this.getValue());
        this.callParent();
    }
});

To do the same for single combobox:

{
    picker: 'edge',
    xtype: 'combobox',
    valueField: 'id',
    displayField: 'description',
    queryMode: 'local',
    store: 'optionsStore',
    listeners: {
        // Add this..
        expand: function(field) {
            field.getPicker().setValue(field.getValue());
        }
    }
}
1
votes

For our scenario, the problem is when we refreshed the page. Using your override suggestion, only when I opened on the second time the value is selected correctly.

So we are using the following override to fix this behavior:

Ext.define('Ext.override.field.Select', {
    override: 'Ext.field.Select',
    updatePickerValue: function (picker, value) {
        if (!value) value = this.getValue();
        picker.setValue(value);
    }
});

It is almost the same, but we are overriding the updatePickerValue method.

Thanks for you help!

  • Renato Carvalho