I’m using ExtJS 4 and looking for a way I can hide currently selected value from combo’s dropdown list?
So instead of this (“Alaska” currently selected in combobox):

I want the list of values look like this:

In my case the combobox is not editable (i.e. you can’t input an arbitrary value), I don’t think it makes much sense to display the selected value two times: once in the input field and once in the dropdown list. I already see what is selected, I want the dropdown list to only show me other options I can select.
So far I don’t see an easy way to do it. Probably the best place to start at is filtering combobox store but combobox uses its own filters for live search functionality.
Anybody considered this problem? Am I trying to do something weird?
I’m surprised that I haven’t been able to find any related topics.
I ended up using a modified version of @sra’s solution:
The ‘hiding’ logic is the same, only I perform it in the
setValuemethod to make sure that it also works when programmatically setting combo’s value, including the case where the combobox is initialized with a value.UPD Also, looks like
store.add(this.selectedRecords);has to be called beforethis.callParent(arguments);, otherwise combobox will act weird if we attempt to set the same value twice (it simply wouldn’t find the active record in the store cause we removed it, so it’ll reset to blank).I suspend store’s events to prevent some quirks caused by combobox trying to synchronize with its dropdown list in the middle of my manipulations with selected record(s) and manually trigger store’s
'refresh'event when I’m done so the list gets eventually updated. This may have performance impact but so far I don’t know a better solution.