OptionGroup uncheck item

Hi guys,
I’m a beginner… I’m writing a web application with vaadin,… My problem is: I wrot a class that implements the Property.ValueChangeListener interface and in the method "public void valueChange(ValueChangeEvent event) " I would like that if the user clicks on a Item of the OptionGroup the program automatically unselect (uncheck) another item… But I cannot see a method to do that… I found the select method to select another item but not the unselect or uncheck method, there is a way to do that?

Thank you in advance…

Hey, OptionGroup is an AbstractSelect that comes with select(itemId) and unselect(itemId) methods. They’re meaningful only if OptionGroup is in multi select mode, see setMultiSelect(boolean). If not in multi select mode you can only select one item at a time with setValue(itemId). To deselect value use setValue(null).

Also notice that when you ask for the value with getValue, in multi select mode you’ll get a set of selected values, otherwise you’ll just get single itemId describing the single selected value.

Other thing to remember with OptionGroup and ValueChangeListener as well as with other select components as well is to set them to immediate mode setImmediate(boolean). In immediate mode the ValueChangeListener is invoked right after user has clicked on the component. Otherwise value is changed only after some other immediate event is fired.

Hope these help.

Thank you very much… I didn’t see it and many thanks for the suggestions …

Just another thing, is possible use OptionGroup in combination with table? I need a table with inside a OptionGroup but I had no luck to do it… The idea is to have an Item per row…

I’m trying to do something like that…

          Table table = new Table();
            table.addContainerProperty("Name", String.class, null);
            table.addContainerProperty("Value", Item.class, null);
            List<String> list=getList();
    		OptionGroup og = new OptionGroup(null, list);
    		int a=1;
    		for (String elem: list){
    			table.addItem(new Object[] {"Name_"+a, og.getItem(elem)}, new Integer(a));

I tried also with this:

for (Object elem: og.getItemIds()){
    			table.addItem(new Object[] {"Name_"+a, og.getItem(elem)}, new Integer(a));

with no luck!!!

Can you show me my mistake, please?

Thanks again