Adding Embedded objects to Table

Hello,

After reading the thread “How to add images to table?”, it appears that adding Embedded objects to a Table is possible.

In my case I have created a graphical button which extends on Embedded.

To add this graphical button to my Table, I have tried the following code:


Table drillDownReportTable = new Table();

drillDownReportTable.addContainerProperty("Flowchart Name", String.class, null);
drillDownReportTable.addContainerProperty("Status", HorizontalLayout.class, null);
drillDownReportTable.addContainerProperty("Embedded", Embedded.class, null);

HorizontalLayout h = new HorizontalLayout();
h.addComponent(new Label("test"));
h.addComponent(new Button("Test"));
h.addComponent(gfxButton); // Graphical button
h.addComponent(new Label("test2"));

// Add each item to the table
drillDownReportTable.addItem(new Object[] { "Item #1", h, gfxButton }, "Item #1");

As you can see I’m attempting to add the Embedded object either in a layout or directly, but neither works. Please see the screenshot below. In the screenshot, directly above the table I have added the graphical button so you can see what I’m trying to add into the table.

Is there something I am doing incorrectly?

Thanks,
Ajay

It seems that you are adding the same widget - gfxButton - twice to the table row. Each widget can be only one in the component tree, try to remove the second reference to the same component instance.

That worked.

Thanks Joonas!