TreeTable with many to one on two tables

Hi

I’m searching for a solution for a tree table on my browser view.
I have per example two tables (‘Category’ and ‘Subcategory’)

Every category can have multiple subcategories.
Table subcategories have a foreign key to id of table category.

I wanted to display this with a tree table, but can only fins solutions with entities referencing themselves.

Is this possible?

Thanks
Thomas

Hi,

All table components (Table, GroupTable, TreeTable, DataGrid and TreeDataGrid) can only display items of the same type. If Category and Subcategory entities have the same set of attributes, consider to make a base class for them (an entity marked as mapped superclass).

Gleb

Hi Gleb

thanks for your answer. But there are some differences between category and subcategories.
But I know what you mean with that.

Is there another way to display such a structure in cuba studio?

Thomas

Take a look at DataGrid Details Generator (see online demo). It can be useful for your requirements. Pay attention that there is a known Vaadin issue, so that a DataGrid can’t be used as details for a DataGrid.

Gleb

Hi Gleb

But this Details Generator is not a Option in Cuba Studio that I can configure?
I have to script that myself?

Thomas

Yes, you need to create it programmatically as shown in the online demo above.