ExtJs Combo lastQuery

There’s a seemingly insignificant property in an ExtJs combo. It’s called lastQuery. It holds (no surprise here!) the query that has been used by a combo previously (for remote combo stores). Thing is, it affects the querying, too, because if you’re using the same query several times, the combo won’t refresh the list. That is, it won’t send the request again, it will get you a cached dataset.

If you want the data to be requeried each time though, there’s a way to do it:

var combo = new Ext.form.field.ComboBox({
    ...
    queryMode: '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;
        }
    }
});
Advertisements

About Maryna Cherniavska

I have productively spent 10+ years in IT industry, designing, developing, building and deploying desktop and web applications, designing database structures and otherwise proving that females have a place among software developers. And this is a good place.
This entry was posted in ExtJs. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s