Im currently experiencing some problems with a OptionGroup im trying to use to be able to select multiple choices for my model. I got a model which I create a Form for using a FormFieldFactory, I got 3 properties on this model, name, description and a set of tags.
- Model class -
String name
String description
Set<MyTagObject> tags
FormFieldFactory creates normal text fields for name and description and these work like they should so I created a multiselect optiongroup for the tags. As I think this is the best way to select these instead of ctrl/shift click within a list.
In the FormFieldFactory I first retrieve all available tags and store them in a list sorted. And then do the following:
final OptionGroup field = new OptionGroup("tags");
field.setMultiSelect(true);
for (final MyTagObject tag : tags)
{
field.addItem(tag);
field.setItemCaption(tag.caption());
}
Everything renders like it should the ordering of items, captions, the option group label and even the existing tags are checked when loading a existing model from the database.
But the optiongroup is readonly:
<div class="v-select-optiongroup v-readonly" style="">
and all options are disabled:
<span class="v-checkbox v-select-option v-checkbox-disabled v-disabled">
<input type="checkbox" value="on" id="gwt-uid-15" tabindex="0" disabled=""><label for="gwt-uid-15">Tag 1</label>
</span>
I have tried forcing the field to be enabled and not readonly and setting each item as enabled with:
field.setEnabled(true);
field.setReadOnly(false);
and in the loop:
this.setItemEnabled(tag, true);
but nothing changes. So any help would be appriciated.