سؤال

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.

هل كانت مفيدة؟

المحلول

Simply use SelectItem#setValues()

selectMultiple.setValues("Dog","Goat");
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top