Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Grid BeanItemContainer Expand NestedBean property automatically
I have a Nested Entity
-- Adress address
I am using BeanItemContiner<Person> 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
-- List<Adress> 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?
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.
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 :)