ExtJS combobox won't reload store after submittinig another form
I have a combobox and a form window opening on the same page. The combobox code is:
combo1 = new Ext.form.ComboBox({
fieldLabel: 'Intrested in',
hiddenName: 'interest',
store: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'ajax.php',
method: 'GET'
}),
reader: new Ext.data.JsonReader({
root: 'rows',
fields: [{
name: 'myId'
}, {
name: 'displayText'
}]
})
}),
valueField: 'myId',
displayField: 'displayText',
triggerAction: 'all',
emptyText: 'Select',
selectOnFocus: true,
editable: false
});
First time the list fetched from SQL table is loaded correctly.
On the same page there is a window with a short form submitting new values to sql database, but after submitting it and opening the combobox, the list is not refreshed.
ONLY after submitting the form again I can see the previously added values.
Why doesn't the combobox reload automatically after the开发者_Go百科 first submitting?
The problem here is, that the combobox internally caches the so called "last query" - if that doesn't change it does not reload its data from the store. So the solution is to reset this "last query" parameter:
combo1.lastQuery = null;
精彩评论