OptionGroup how to deselect all (reset group)

Hello,

how can I reset the OptionGroup to the intial state ? I want to deselct all elements.

Regards
Eduard

optionGroup.setPropertyDataSource(null);

Does not work.


         List<String> cities = Arrays.asList(new String[] {
            "Berlin", "Brussels", "Helsinki", "Madrid", "Oslo", "Paris",
            "Stockholm" });

        citySelect = new OptionGroup("Please select cities", cities);

        citySelect.setMultiSelect(true);
        citySelect.setNullSelectionAllowed(true); 
        citySelect.setImmediate(true); 
        
        citySelect.select("Berlin"); 
        citySelect.select("Helsinki"); 
 
    
 
        // Try to deselect all 
        citySelect.setPropertyDataSource(null);
       // Berlin and Helsinki are still selected !!!

I want to deselect all entries.

optionGroup.setValue(null);

That is working !!!

Thank you !!!

guys… i want deselect specific item. how?

How about using getValue() to get all selected values, removing the item from the array you want to deselect and then use setValue() to select the remainining items? (Not tried it but should work in theory)