-
13 Feb 2012 10:46 AM #1
Why is there no getSelectedIndex() in ComboBox<T> but there is in SimpleComboBox?
Why is there no getSelectedIndex() in ComboBox<T> but there is in SimpleComboBox?
Was there a specific reason the getSelectedIndex() method is only in SimpleComboBox and not in the parent class ComboBox<T>? I don't see anything that would prevent it from working correctly in the parent class given the actual implementation code:
Code:public int getSelectedIndex() { T c = getValue(); if (c != null) { return getStore().indexOf(c); } return -1; }
-
14 Feb 2012 4:18 AM #2
A guess would be that if you expand the functionality of a ComboBox you're supposed to use the parent type, which could invalidate the getSelectedIndex method, which indicates that it would only have one selection. For instance this idea would invalidate the single selection assumption: http://www.sencha.com/forum/showthre...ighlight=Combo
-
14 Feb 2012 10:13 AM #3
Hmm. But aren't combo boxes, by definition a single-selection entity? Otherwise, it's a list box (ListField?) or a single-column grid.
-
14 Feb 2012 10:41 AM #4
Intuitively I wouldn't use it for the case shown before. I think that - as with most things in programming - most things can be tweaked and modified for specialized rules making it impossible to use definitions like that impossible. The definitions will usually only hold until someone tweaks it

-
14 Feb 2012 10:42 AM #5
"The definitions will usually only hold until someone tweaks it."
Indeed.


Reply With Quote