Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    41
    Vote Rating
    1
    rondestvedt is on a distinguished road

      0  

    Default ComboBox not losing focus

    ComboBox not losing focus


    When a user selects a value in a ComboBox and then selects a different window (outside of the browser), the ComboBox doesn't lose focus unless the user selects the ComboBox again. This causes the newly selected value to not be set, even though it appears to have been selected. The wrong value is then sent to the server on submit of the form. We are seeing this on IE 9.

  2. #2
    Sencha User
    Join Date
    Oct 2013
    Posts
    1
    Vote Rating
    0
    John Viking is on a distinguished road

      0  

    Default


    Hello.
    I had the same problem. I know this is not a systemic solution, but I solved it with following workaround. Try it


    Code:
    combo.addCollapseHandler (new CollapseHandler () {
      public void onCollapse (CollapseEvent event) {
        combo.finishEditing ();
      }
    });

  3. #3
    Sencha User
    Join Date
    Nov 2013
    Location
    Bangalore, India
    Posts
    98
    Vote Rating
    7
    vardhan22 is on a distinguished road

      0  

    Default


    Hi All,

    I am facing this issue in GXT 3.0.1 with combobox as well as with DateField
    Is this solved, in which release? GXT 3.0.6 or GXT 3.1

    And this does not happen always. Only some times. In combobox, this problems appears more frequently

    Thanks

  4. #4
    Sencha User
    Join Date
    Mar 2012
    Posts
    88
    Vote Rating
    3
    esag_dk is on a distinguished road

      0  

    Default


    How long are you going to ignore this problem? It was already a problem 3 years ago, and you can find many more threads about it.
    It's a common workflow: select a value -> the view changes -> focus another component. And yet you can't achieve this without some really dirty hacks. But since I've finally made it, I want to share this hack (I won't even call it a workaround) with you:

    First we need a custom ComboBoxCell:
    Code:
        private class BlurComboBoxCell extends ComboBoxCell<String>
        {
    
    
            public BlurComboBoxCell()
            {
                super(new ListStore<String>(new ModelKeyProvider<String>()
                {
                    @Override
                    public String getKey(String item)
                    {
                        return item.toString();
                    }
                }), new LabelProvider<String>()
                {
                    @Override
                    public String getLabel(String item)
                    {
                        return item;
                    }
                });
            }
    
    
            public void blur()
            {
                appearance.onFocus(lastParent, false); // remove the blueish border
    
    
                // copied from: TriggerFieldCell.doTriggerBlur
                triggerBlur(lastContext, lastParent, lastValue, lastValueUpdater);
                onBlur(lastContext, lastParent, lastValue, null, lastValueUpdater);
            }
    
    
        }

    And here a simple example, using a ComboBox and a DateField, which shall be selected after a combobox value was selected:


    Code:
     VerticalLayoutContainer vlc = new VerticalLayoutContainer();
            vlc.setPixelSize(500, 500);
    
    
            final DateField date1 = new DateField();
            date1.setValue(new Date());
    
    
            final ComboBox<String> comboBox = new ComboBox<String>(new BlurComboBoxCell());
    
    
            comboBox.setTriggerAction(ComboBoxCell.TriggerAction.ALL);
            comboBox.setEditable(false);
    
    
            comboBox.getStore().add("Muh");
            comboBox.getStore().add("Buh");
    
    
            comboBox.setForceSelection(true);
    
    
            comboBox.addSelectionHandler(new SelectionHandler<String>()
            {
                @Override public void onSelection(SelectionEvent<String> stringSelectionEvent)
                {
                    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand()
                    {
                        @Override public void execute()
                        {
                            // first scheduler: here we blur the combobox
                            ((BlurComboBoxCell) comboBox.getCell()).blur();
    
    
                            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand()
                            {
                                @Override public void execute()
                                {
                                    // a second scheduler: here we focus our second field
                                    // it won't work with only one scheduler, though
                                    date1.selectAll();
                                    date1.focus();
                                }
                            });
                        }
                    });
    
    
                }
            });
    
    
            vlc.add(comboBox, new VerticalLayoutData(250, 30));
            vlc.add(date1, new VerticalLayoutData(250, 30));