You found a bug! We've classified it as a bug in our system. We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext JS Premium Member
    Join Date
    Oct 2007
    Posts
    2
    Vote Rating
    0
    Croaker is on a distinguished road

      0  

    Question [CLOSED-656] ComboBox doesn't select an option on tab

    [CLOSED-656] ComboBox doesn't select an option on tab


    Hi,

    the problem is that the ComboBox doesn't select a value if you select an item from the drop-down list and press the tab key. In earlier versions this was working. I'm not sure if this is wanted behavior or not.

    In rev. 5850 the "tab" function of the KeyNav was changed from:
    Code:
                "tab" : function(e){
                    this.onViewClick(false);
                    return true;
                }
    to:

    Code:
                "tab" : function(e){
                    this.collapse();
                    return true;
                }
    The ComboBox-config I used in both revisions:
    Code:
    {
    	xtype: 'combo',
    	...
    	store: new Ext.data.SimpleStore({
    		fields: [ 'localized', 'value' ],
    		data: [["Yes","yes"],["Maybe","maybe"],["No/Internal","no/internal"]]
    	}),
    	valueField: 'value',
    	displayField: 'localized',
    	triggerAction: 'all',
    	forceSelection: true,
    	mode: 'local'
    }
    Best regards,

    croaker

  2. #2
    Ext User
    Join Date
    Mar 2009
    Posts
    9
    Vote Rating
    0
    ronbravo is on a distinguished road

      0  

    Default


    Is there a link to the bug tracking for this issue? I would like to know when it gets fixed. Until then I am going back to version 3.0.0.

  3. #3
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    I believe this is the same bug as issue #606, and has already been resolved in SVN:
    http://www.sencha.com/forum/showthread.php?t=92466

  4. #4
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    Same issue, and it's one where some people want the selection on tab and others don't. The determining factor in 3.2 at the moment is forceSelection: true. In your example, if someone types 'y' and then tabs, what do you feel it should do?

  5. #5
    Ext JS Premium Member
    Join Date
    Jul 2009
    Posts
    239
    Vote Rating
    2
    stephen.friedrich will become famous soon enough

      0  

    Default


    If I have use UP/DOWN to select an entry from the list (like the original poster said), then I definitely always want to commit that value on tab.
    I think all common GUI toolkits that I used so far (Java Swing, MS MFC, MS WPF and others behave like this).

    If I tab out after just typing "y" then I want to leave that value intact and only show a validation error.

  6. #6
    Sencha User Screamy's Avatar
    Join Date
    Jun 2008
    Posts
    244
    Vote Rating
    0
    Screamy is an unknown quantity at this point

      0  

    Default


    I agree 100% with Stephen.

    When you press tab, the currently highlighted item in the list should be accepted as the desired value. This behavior is exhibited in every other major GUI development tool I've used.

    Regardless, I didn't see anything in the docs for version 3.2.1 on the relatively simple fix for this issue:

    Code:
     var combo = new Ext.form.ComboBox({
      allowBlank: false,
      autoComplete: true,
      displayField: 'username',
      forceSelection: true,
      listeners: {
        afterrender: function(component) {
          component.keyNav.tab = function() {
            this.onViewClick(false);
          };
        }
      },
      mode: 'local',
      store: someComboStore,
      triggerAction: 'all',
      valueField: 'userId',
      width: 250
    });

  7. #7
    Ext JS Premium Member
    Join Date
    Nov 2011
    Posts
    10
    Vote Rating
    0
    jthakkar is on a distinguished road

      0  

    Default


    Amazing solution Screamy. It worked thanks a lot.