Selecting values from OptionGroup

Hi

I have OptionGroup with Multiselect set to True. I need to store the list of values selected based on the checkbox selected. I am wondering how to do that.

private static final List jobCategories = Arrays.asList(new String {“Job1”, “Job2”});

jobSelect.setMultiSelect(true);
jobSelect.setNullSelectionAllowed(false);
jobSelect.setImmediate(true);
jobSelect.addListener(listener);

… private Property.ValueChangeListener listener = new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
[size=2]
[color=#fd0d0d]

[/color]
//Not sure how to get lit of Jobs from PropertyValue

[/size]
}
};

With jobSelect.getValue() you get a Collection of the selected item IDs (strings). See
here
for an example.

This gives all the selected values with the format [xx, xxx, xxxx]
. Is it possible to get only the actual values xx, xxx, xxxx or a list of Strings ?

Thanks

It
is
a list of Strings (or itemIDs to be exact), the "[xx,xx,xx]
" is just the toString() value of the Collection of strings.

getItemIds() method returns all the values and not the only selected values. I would like to know how to retrieve only the selected values from event.getValue();

I said “jobSelect.[i]
getValue
/i”, not “jobSelect.getItemIds()”.

You can also use “event.getProperty().getValue()”.