It’s not quite as intuitive as you’d expect.
cb.store.removeAll(); // force the reload on trigger cb.lastQuery = null;
The above assumes you keep your Ext.Form around, even after you close an Ext.Window containing the form. If the form is actually destroyed on close, the default, your Combo will be recreated anew. The above is more useful when, for example, an Ext.Window with a search form where you want to keep the selection state and you setValues() on a show event.
4 Comments
Thanks - This was helpful
I had a similar problem where I wanted to mark a bunch of stores to be reloaded the next time their respective combo boxes were used. Since I was getting the stores via the Ext.StoreMgr, I did not have access to the combo box that each store was attached to, so I couldn’t set the combo box’s lastQuery to null.
I found that the following also works:
function clearStore( dataStore)
{
dataStore.removeAll();
dataStore.totalLength = 0;
}
One would think this would have been done when the removeAll method was called, but it isn’t. Maybe that’s a bug.
I need only reload de data os my combo becouse the data alway came from ajax but my combo wwas caching the data os last ajax to solve it i need put a
combo.store.reload();
after my ajax function who chance the data section of combo box
Thanks for this, its been 4 days i search the solution to clear the combobox and i found nothing work until i read this, it solve my problem.