PDA

View Full Version : Prevent Cycling on ComboBox



Ramsay
2 Nov 2012, 8:39 AM
When you key down in an expanded combobox, if you get to the end, it wraps back to the top. Is there a simple way of preventing that? It looks like the highlightitem event on the Combo's boundlist could perhaps be hooked?

skirtle
3 Nov 2012, 12:12 AM
The wrapping is in the BoundListKeyNav:

http://docs.sencha.com/ext-js/4-1/source/BoundListKeyNav.html#Ext-view-BoundListKeyNav

Changing the key handlers is quite easy but it isn't immediately obvious to me what the easiest way to hook this into a combobox would be. If you want this behaviour for all your comboboxes then you could just alter BoundListKeyNav itself with a patch. If you want to do it selectively then one way to do it is to add your own config option for a BoundList and choose the appropriate behaviour in BoundListKeyNav based on that config.