0
votes

In my MVC application I have a controller defined like this:

Ext.define('NE.controller.MyController', {
    extend: 'Ext.app.Controller',
    stores : [...'StoreAgents'..],

    views: [ ...'MyView'...], // * alias w_view

    init: function() {
        this.control({
            'w_view': {
                render: function() { this.getStore('StoreAgents').load(); }
            }
        });
    }
});

And in the view MyView I have a combobox defined like this:

{
    xtype: 'combobox',
    name : 'id_agent',
    forceSelection: true,
    fieldLabel: 'Agent',
    store: 'StoreAgents',
    queryMode: 'local',
    displayField: 'name',
    valueField: 'id'
}

I would expect combobox list to be updated every time the view is rendered, am I wrong? Currently the combobox remains with no options, even if I see (through firebug) that the application fires the request which correctly returns all agents data.

Furthermore, I noticed that whenever I browse through another view, managed by another controller, which in turn declares another StoreAgent and calls its load() method.. well, if I come back, now I see the combobox populated.

What I am missing? Thank you

Edit: I noticed that the store is {buffered: true}. If I switch it to false, then the store fires the 'datachange' event; otherwise it does not. So the question now is: why if buffering is enabled the load() does not fire 'datachange'?

1

1 Answers

0
votes

This may be due to a filtered out situation. If the combobox is being filled with a value before the store loads, a filter will be put on the store that filters out all the values before they exist, and then when new records are added they are not displayed either. Try this.

init: function() {
        this.control({
            'w_view': {
                render: function() { this.getStore('StoreAgents').load(); 
                this.getStore('StoreAgents').clearFilter();}
            }
        });
    }