Use a DataTable - SubTable as in the official sample here
Primefaces datatable with inner ui:repeat
-
30-09-2022 - |
Question
I am currently using PrimeFaces and I am quite satisfied with it. But now I am stuck.
I am displaying a p:DataTable with my entities. My entities also have child entities which I also want to display. Each child entity of my parent entity should result in a new row with the data of the parent entity and the data of the child entity.
So something like this:
Parent1.A | Parent1.B | Parent1.C | Child1.A | Child1.B
Parent1.A | Parent1.B | Parent1.C | Child2.A | Child2.B
Parent1.A | Parent1.B | Parent1.C | Child3.A | Child3.B
[...]
So I tried something like this, but this didn't work..
<p:dataTable value="#{myBean.entities}" var="entity">
<ui:repeat value="#{entity.children}" var="child">
/* dataTable columns ... */
</ui:repeat>
</p:dataTable>
This code won't show anything unfortunately.. without the inner repeat, the dataTable is displayed (of course without the children entity data..). How can I achieve this way of data display?
Thanks for your help in advance!
Best regards!
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow