Multi level table

Is there any way I can have Vaadin create multi level tables without creating a completely new component? (Thinking something like “RowRenderer”)?

With multi level table, I don’t mean something like the planned
since I need different rows to have different columns. Such as this:

Maybe I should skip the Table altogether???

There are several reasons why the current table component is not well suited as the outer table here. The implementation is not designed for such extensibility (it is complicated enough with the current features), and e.g. lazy loading would have problems with such variable height rows. Maybe the table rendering becomes more flexible sometime in the future, but that will probably not happen very soon.

You could use Table as the inner table but something else for the outer one - a CssLayout/VerticalLayout containing a CssLayout for each top-level table row. The inner CssLayout would then contain the expand button, fixed width columns for the top-level data and the expanded inner table (present/visible only when expanded).

Another option would be using GridLayout with the inner tables spanning whole rows.

With either alternative, you do lose lazy loading of data at least for the outer table.

BTW, I believe the TreeTable will soon be available as an add-on in case you want to test it, too.

Same problem as with
Form spanning multiple TabSheet tabs
, I cannot add the VerticalLayout to the Form and thus need one Form per row…

I’ll see if I can come up with some way to wrap non-Field Components so that Fields can be recursively added to the Form.

Actually, I think this may be beneficial to more people, so I created an
enhancement ticket

While Form is not a ComponentContainer, its layout is, and form fields do not need to be directly in its own layout.

You can use myForm.getLayout().addComponent(myVerticalLayout) and override Form.attachField() to achieve this, or set an arbitrary layout for the form with Form.setLayout().

Closed the ticket - please re-open if this does not work properly.

Regarding overriding attachField(), does it make sense to requestRepaint() even if nothing is attached…?

I’ll givet it a try, but I still think there should be a “prettier” way than overriding with empty methods.

I tried to have a GridLayout in a Form and do as you say.
I extends my class with Form.class I create the GridLayout add my components to the layout and finally set the gridlayout as the layout of the form this work cause i don’t register the fields in the form.
But when i override Form.attachField() by an empty method, in order to register the field by calling addField, this display none fields of my form :confused:
Do you have some idea, on what is causing this ?