سؤال

I'm using ExtJS 4.2.1.883 to build a grid with RowEditing capabilities. I've been struggling with this for a few days, even though I do read the documentation and search the Web extensively.

The problem at hand: one of the columns in my grid is a ComboBox defined like so:

Ext.define('myapp.view.editor.MyComboBox', {
    extend: 'Ext.form.field.ComboBox',
    alias:  'widget.my-combo-box',

    triggerAction: 'all',
    queryMode: 'local',
    displayField: 'ShortName',
    valueField: 'Identity',
    store: Ext.create('myapp.store.business.MyStore'),

    editable: false,
    forceSelection: true,
    emptyText: 'Select an item...',
    multiSelect: false
});

Its corresponding store extends Ext.data.Store and has autoLoad: true. It is backed by a very simple model that only has three type: 'string' fields and has the identity field set as idProperty: 'Identity'.

Now, when I double-click a record in the grid to edit, intermittently the combo field becomes empty (although it had a value in it prior to double-click); worse yet, the combo would not open after that. Even if I close and then reopen the editor. I say intermittently, because I was unable to reproduce this behaviour reliably. Sometimes it just does. Sometimes it does not, no matter how many times I summon row editing. Also note that the data coming from the store does not change, it's a stable dataset migrated for testing purposes from a previous version of the system.

Yesterday I saw another event that seemed like a bug: the first entry in the combo was duplicated. I rechecked the backend to make sure it only sends one instance of the record. Today, after simply reloading the Web UI of the application, I cannot reproduce this, even though the code didn't change overnight.

[Edit] There are no errors or warnings in my Chrome console.

Is there a valid reason for such behaviour on the part of ComboBox? How do I make it behave properly?

I'd also like to know if moving to a later version of ExtJS 4 would be wise, bug-wise. I've had it with the version I'm currently using, mostly for being unable to follow the development schedule due to all the inconsistencies and workarounds and the sheer size of the thing (by comparison, Common Lisp I use for backend seems like a nineteenth century wooden toy and it mostly just works), but I'm also reluctant to switch even minor versions mid-project, let alone switch frameworks.

هل كانت مفيدة؟

المحلول

you should set the store as a string like:

store: 'business.MyStore'

and add the store to the controllers store array. I also had options like editable ore typeAhead enabled. the store is only filtered as long as you are in edit mode as soon as you leave edit the store is unfiltered again.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top