Bill Garrison
Bill Garrison

Reputation: 2227

Extjs 3.4 How to force a combobox to reload its dropdown

So I have a combobox that reloads its store upon expansion. I am able to get the store updated but I can't seem to get the combobox to display the new info in the store. It keeps on showing the old information. I have used almost every method and have been fooling around for hours. I am also being forced to use extjs 3.4.

General idea of my code:

codeFilterCombo = new Ext.form.ComboBox ({
    id: 'filterByFlagField',
    allowBlank: true,
    editable: false,
    lazyRender: true,
    width: 220,
    name: 'flagFilterCombo',
    displayField: 'msg',
    valueField: 'icon',
    hiddenValue: 'icon',
    hiddenId:'FlagFilterHidden',
    hiddenName: 'FlagFilter',
    triggerAction: 'all',
    mode: 'local',
    tpl: resultTpl,
    listeners: {
        expand: function() {
            this.store.removeAll();
            var data = getAvailableFlags();
            this.store.loadData(data);
            this.show();
        }
    }        
});

Upvotes: 1

Views: 3937

Answers (2)

foddex
foddex

Reputation: 541

Really old question, but maybe it will still help someone. I think you're approaching this wrong. If you want your store to reload every time the combobox is opened, you're supposed to delete lastQuery.

From the documentation:

var combo = new Ext.form.ComboBox({
    ...
    mode: 'remote',
    ...
    listeners: {
        // delete the previous query in the beforequery event or set
        // combo.lastQuery = null (this will reload the store the next time     it expands)
        beforequery: function(qe){
            delete qe.combo.lastQuery;
        }
    }
});

Upvotes: 2

code4jhon
code4jhon

Reputation: 6034

I would try changing mode:local to remote.

Upvotes: -1

Related Questions