How to use FlexibleOptionGroup inside vaadin table?

I need to use OptionGroup inside my table cell of one column. If one item is selected other item should be deselected. In general optiongroup we cannot add item to different cells of table. So I am using FlexibleOptionGroup. But I don’t know how to use this using table field factory like this. If propertyId.equals(“option”) the optiongroup Item should add to the table cell.

[code]
resultTable.setImmediate(true);
resultTable.setTableFieldFactory(new DefaultFieldFactory() {
public Field<?> createField(Container container, final Object itemId, Object propertyId,
Component uiContext) {
if (propertyId.equals(“option”)) {

         }
         Field field = super.createField(container, itemId, propertyId, uiContext);
         field.setReadOnly(true);
         return field;
    }

});
[/code]Can anybody help me about this…

Apparently FlexibleOptionGroupItemComponent doesn’t extend Field, which is what you would need in this particular case. Not surprising though, because the FieldFactory would probably go bananas with a setup like this… The other option is to build the functionality yourself. You would need to create a separate optiongroup for each property, and connect valueChangeListeners so that when one item is selected in another column, the current selection is made empty.

Hi,
Thank you for your response.
In below link (5th highlight) they have used FlexibleOptionGroup inside vaadin table.Can u tell me how to use as they mentioned in that link.
I want to use option group in every row.May be i was wrong of using field, can u suggest any other ?


https://vaadin.com/directory#addon/flexibleoptiongroup

Waiting for ur reply.

Didn’t look that closely, but the source code link includes demo code. It should contain the code for the screenshot too:
https://github.com/henrikerola/FlexibleOptionGroup/blob/2.1/flexibleoptiongroup-demo/src/main/java/org/vaadin/hene/flexibleoptiongroup/FlexibleOptionGroupUI.java

There is no demo there.

Starting on row 228 he creates a Table and fills it with FlexibleOptionGroup components using a ColumnGenerator; I think this is exactly what is shown in the last screenshot in the Directory.

So, you can’t use FieldFactory since the partial OptionGroups aren’t Fields. But you can use generated columns, since those accept normal Components.

Thank you Thomas Mattsson. Now I am getting it perfectly.

I am having another doubt on link

https://vaadin.com/forum#!/thread/7770525

Can you please help me to overcome this problem…