javagwtsmartgwt

SmartGwt SelectItem Multiple select programmatically


I am new in SmartGWT and trying to select items of a SelectItem Widget programmatically. But didn't found a solution for that.

This is what I want:

enter image description here

This is my current code from the SmartGWT examples:

 SelectItem selectMultiple = new SelectItem();
      selectMultiple.setTitle("SelectItem: ");
      selectMultiple.setMultiple(true);
      selectMultiple.setMultipleAppearance(MultipleAppearance.PICKLIST);
      selectMultiple.setValueMap("Cat", "Dog", "Giraffe", "Goat", "Marmoset", "Mouse");

How can I select Items programmatically? Found nothing about that.


Solution

  • Simply use SelectItem#setValues()

    selectMultiple.setValues("Dog","Goat");