Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Comboboxitem, only valid values

    Hi,
    I use a comboboxItem filled in this way:

    Code:
    String[] values = new String[2];
    values[0] = "Item1";
    values[1] = "Item2";
    combobox.setValueMap(values);
    I also added a changeHandler to the combobox.

    My problem is, that the onChange Method is called any time, the user typs in a character in the combobox, even if the value he typed is not in the list of the combobox.

    My question, can I get a list of all items in the combobox, so that i can do something like this:

    Code:
    public void onChanged(ChangedEvent event) {
          if(isItemValid(combobox.getDisplayValue())){
              //do something with the correct item
          }else{
              //do nothing
          }
    }

    #2
    There's a SmartClient method available via JSNI filterClientPickListData() which will be added to SmartGWT at some point. If you prefer not to use JSNI you can always filter the valueMap yourself with just a few lines of code.

    Comment


      #3
      Thank you for your fast answer.

      Originally posted by Isomorphic
      [...] you can always filter the valueMap yourself with just a few lines of code.
      Ok, but how? Is there a possibility to get back the valueMap from the combobox?

      Greets Major

      Comment

      Working...
      X