Grid BeanItemContainer Expand NestedBean property automatically

Hi All,

I have a Nested Entity

Person
– name
– Adress address

Address
– city

I am using BeanItemContiner for my grid. Is it possible to tell gris to expand all the nested properties by itself, instead of telling it programatically ?

I want to show cols name, city in the grid. (column heading is not important, for this question)

Secondly, If it is indeed possible.

what happens in the scenario

Person
– name
– List addressList

Does it works here aswell?

If for some reason there is no explicit functionality out of the box, can I somewhow use SingeAttribute property of the fields in my entity to achieve the same result?

thanks
Chahat

There is a chapter about this in our book, see it here https://vaadin.com/docs/-/part/framework/datamodel/datamodel-container.html

But my own practice is to usually avoid these. If I am starting to have more complex data model with nested beans, I would like to write simple DTO bean which is not nested and which I use in UI. I do the mapping between DTO and data store beans in the business logic. This way I am avoiding putting properties to container that I am not actually needing in the UI. This will optimize also the memory consumption of the application.

HI Tatu,

Thanks fro the reply, Actually I wanted to show my db schema on the UI, for which I was using table. I thought maybe there is a way where Vaadin could automatically expand the 1:1 nested beans so that I do not have to parse the fields of the model myself. But I guess there is no way around.

Thanks for your advice though, will keep ti in mind during implementation :slight_smile:

thanks
Chahat