Success! Looks like we've fixed this one. According to our records the fix was applied for EXTGWT-2427 in a recent build.
  1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    73
    Vote Rating
    2
    tby is on a distinguished road

      1  

    Default ComboBox does not accept null value on enter key

    ComboBox does not accept null value on enter key


    Code:
    @Override
        public Widget asWidget() {
    
    
            VerticalLayoutContainer c = new VerticalLayoutContainer();
    
    
            List<String> choice = Arrays.asList(null, "1", "2", "3");
    
    
            ListStore<String> choiceStore = new ListStore<String>(new ModelKeyProvider<String>() {
    
    
                @Override
                public String getKey(String pItem) {
                    return pItem;
                }
            });
    
    
            choiceStore.addAll(choice);
            
            ComboBox<String> cb = new ComboBox<String>(choiceStore, new LabelProvider<String>() {
    
    
                @Override
                public String getLabel(String pItem) {
                    return pItem;
                }
            });
            
            c.add(cb);
    
    
            return c;
        }
    Expected:
    When I navigate the ComboBox dropdown list with the arrow keys and press enter while the desired value is highlighted, the ComboBox should collapse and display the selected value.

    Actual:
    Selection works well for the values 1, 2 and 3. Selecting the null value by pressing the enter key does not work. The ComboBox does not collapse.

  2. #2
    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


    I moved this thread to the proper forum so we can take a look. Thanks for reporting.

  3. #3
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    39
    Vote Rating
    2
    hcr is on a distinguished road

      0  

    Default


    Hi sven,

    anything new on this one?

    Thanks,
    -hcr-

  4. #4
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    39
    Vote Rating
    2
    hcr is on a distinguished road

      0  

    Exclamation


    Hi there, any chance of getting that fixed any time soon?

    Thanks and best regards,
    -hcr-

  5. #5
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,634
    Vote Rating
    79
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    I've spent a little time working on this, and have a few points to share:

    The first issue here is that the example isn't valid - no item is allowed to have a null key. From the ModelKeyProvider javadocs:
    Code:
      /**
       * Gets a non-null key value that maps to this object. Keys must be consistent and
       * unique for a given model, as a database primary key would be used.
       */
      String getKey(T item);
    The second again has to do with the value 'null' - what does it mean to select nothing? The ComboBox has a ListView that it uses to draw the dropdown, and when the enter key is hit, the ComboBox asks if anything was selected - it asks if the selected item isn't null. I'm changing this check to see if the list of selected items is _empty_ instead, and then finding the location of the null item.

    And one last thought: You can make the item draw full height in the combobox by telling the ComboBox in yet another way that the value null is okay. ComboBox internally uses a SimpleSafeHtmlCell<String> to render, which deliberately skips over null items. This can be replaced by taking over the ListView creation, and making your own cell that draws a null object as a &nbsp;. Here's my finished example, dealing with the first and third issues, and which I am using to find a good workaround for the second:

    Code:
      public Widget asWidget() {
    
    
        VerticalLayoutContainer c = new VerticalLayoutContainer();
    
    
        List<String> choice = Arrays.asList(null, "1", "2", "3");
    
    
        ListStore<String> choiceStore = new ListStore<String>(new ModelKeyProvider<String>() {
    
    
          @Override
          public String getKey(String pItem) {
            return pItem + "";
          }
        });
    
    
        choiceStore.addAll(choice);
    
        ListView<String, String> listView = new ListView<String, String>(choiceStore, new IdentityValueProvider<String>(), new AbstractCell<String>() {
          @Override
          public void render(Cell.Context context, String value, SafeHtmlBuilder sb) {
            if (value == null) {
              sb.appendHtmlConstant("&nbsp;");
            } else {
              sb.appendEscaped(value);
            }
          }
        });
        ComboBox<String> cb = new ComboBox<String>(choiceStore, new LabelProvider<String>() {
          @Override
          public String getLabel(String pItem) {
            return pItem;
          }
        }, listView);
    
        c.add(cb);
    
    
        return c;
      }

  6. #6
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,634
    Vote Rating
    79
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    We've made a fix for this, which is now available in SVN and nightly builds, and will be in the next release. The fix was very nearly as described in my last post - check for an empty set of selected items, rather than asking if the current selected object is null.

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