1. #1
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Question 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;
      }

  2. #2
    Sencha User rohdef's Avatar
    Join Date
    Mar 2010
    Location
    Aarhus, Denmark
    Posts
    67
    Vote Rating
    3
    rohdef is on a distinguished road

      0  

    Default


    Quote Originally Posted by icfantv View Post
    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;
      }
    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

  3. #3
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    Hmm. But aren't combo boxes, by definition a single-selection entity? Otherwise, it's a list box (ListField?) or a single-column grid.

  4. #4
    Sencha User rohdef's Avatar
    Join Date
    Mar 2010
    Location
    Aarhus, Denmark
    Posts
    67
    Vote Rating
    3
    rohdef is on a distinguished road

      0  

    Default


    Quote Originally Posted by icfantv View Post
    Hmm. But aren't combo boxes, by definition a single-selection entity? Otherwise, it's a list box (ListField?) or a single-column grid.
    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

  5. #5
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    "The definitions will usually only hold until someone tweaks it."

    Indeed.

Thread Participants: 1

Tags for this Thread