Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext GWT Premium Member
    Join Date
    Mar 2009
    Posts
    226
    Vote Rating
    3
    The_Jackal is on a distinguished road

      0  

    Default [FNR] GXT 2.2.4 ComboBox force selection fails is ComboBox never expanded

    [FNR] GXT 2.2.4 ComboBox force selection fails is ComboBox never expanded


    The ComboBox setForceSelection does not force a selection if the ComboxBox is never expanded and lazy render is true (the default).

    To preproduce:
    • Create a ComboBox with edit true and forceSelection true
    • Quickly type characters in the box that will not trigger the expansion of the combo options
    • Click or tab out of the box

    Expected Result:
    The combo should force a selection to the last selected option in the combo's list, but it does not - the invalid text is left unvalidated.

    If instead you type one letter that triggers the expansion or click the trigger your self then the combo will force a selection when you tab out.

    Cause and Workaround:
    This issue is caused by the lazy rendering - doForce() calls getValue() which returns the value because the field "initialised" is still false - it should return null because the invalid vale is not in the store's models. The "initialised" field only gets set to true when the combo is expanded.

    The workaround is to disable lazy rendering (which creates the combo list and sets "initialised" to true).

    Ideally you should not have to disable lazy rendering to have force selection work correctly.

    Here is the code to reproduce the issue. Note if you don't set a simple value then you get a validation error (but instead you should get a forced selection)

    Code:
    public class ComboBoxBug implements EntryPoint
    {
        public void onModuleLoad()
        {  
            FormPanel formPanel = new FormPanel();
            
            final SimpleComboBox<String> aCombo = new SimpleComboBox<String>();
            aCombo.setFieldLabel("Validate issue");
            aCombo.setName("field");
            aCombo.add(Arrays.asList(new String[] {"AAA", "AAB", "AAC"}));
            aCombo.setEditable(true);
            aCombo.setForceSelection(true);
            aCombo.setTypeAhead(true);
            aCombo.setAllowBlank(false);
            aCombo.setTriggerAction(TriggerAction.ALL);
            aCombo.setSimpleValue("AAA");
            // GXT bug - if lazy render & not expanded list yet & type invalid text then doforce fails
            //aCombo.setLazyRender(false);
            formPanel.add(aCombo);
            RootPanel.get().add(formPanel);
        }
    }

  2. #2
    Ext GWT Premium Member
    Join Date
    Oct 2008
    Posts
    72
    Vote Rating
    5
    elirov is on a distinguished road

      0  

    Default


    Any updates on this bug?

  3. #3
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    As workaround you can set lazy render to true.

    You could comment out the block in getValue that checks for initialzed, or you could use the workaround for now.

    We could also force the list initialization in a forceselect. This would not be a huge change in behaviour, any thoughts?

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Code:
    Index: user/src/com/extjs/gxt/ui/client/widget/form/ComboBox.java
    ===================================================================
    --- user/src/com/extjs/gxt/ui/client/widget/form/ComboBox.java	(revision 2407)
    +++ user/src/com/extjs/gxt/ui/client/widget/form/ComboBox.java	(working copy)
    @@ -551,6 +551,7 @@
           return value;
         }
         if (store != null) {
    +      store.clearFilters();
           getPropertyEditor().setList(store.getModels());
         }
     
    @@ -1001,6 +1002,10 @@
             return;
           }
     
    +      if (!initialized) {
    +        createList(true);
    +      }
    +
           if (getValue() == null) {
             if (lastSelectionText != null && !"".equals(lastSelectionText)) {
               setRawValue(lastSelectionText);
    Also i am not normally posting a patch to the public, i think its the best for here. If you have any time, you maybe want to test this change and report back here.

  5. #5
    Ext GWT Premium Member
    Join Date
    Mar 2009
    Posts
    226
    Vote Rating
    3
    The_Jackal is on a distinguished road

      0  

    Default


    you maybe want to test this change and report back here.
    Sven, this fix works for me - not sure what effect the store.clearFilters() has, but I see no ill effects so far.

    Can you sent the rev number when you commit?

    Regards,
    The_Jackal

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Fixed in SVN as of revision 2429

Similar Threads

  1. Replies: 0
    Last Post: 2 May 2011, 8:31 AM
  2. Replies: 0
    Last Post: 16 Mar 2011, 12:23 PM
  3. Replies: 4
    Last Post: 21 Oct 2009, 3:40 AM
  4. Force Combobox value if...
    By fruitwerks in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 13 Sep 2009, 12:57 PM
  5. combobox - force selection doubts
    By fother in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 23 Jul 2009, 10:03 AM

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar