2
votes

I have a DataModel which contains IRoomDomain objects. Every IRoomDomain object has an IOccupancy array.

I want to use a data table to display them. Since every IRoomDomain can have several IOccupancy, I want to have a rowspan over the IRoomDomain IDs:

Var is room

 Room ID| Label field 1              | Label field 2              | ...
 -------|----------------------------|----------------------------|------
 //Room1| room.occupancies[0].field1 | room.occupancies[1].field2 | ...
 room.ID| room.occupancies[1].field1 | room.occupancies[1].field1 | ...
        | room.occupancies[2].field1 | room.occupancies[3].field1 | ...  
--------|----------------------------|----------------------------|------
 //Room2| room.occupancies[0].field1 | room.occupancies[1].field2 | ...
 room.ID| room.occupancies[1].field1 | room.occupancies[1].field1 | ...
        | room.occupancies[2].field1 | room.occupancies[3].field1 | ...    
--------|----------------------------|----------------------------|------

I tried a nested data table (1 column room ID, 1 column occupancy data), but it displays the header for every room, not once above as I want it to.

In addition, this construct must be selectable for the Room ID.

Is there any way to realize this with JSF/PrimeFaces? The data model can be changed, but the relation not.

Thanks in advance.

1

1 Answers

0
votes

Yes, using PanelGrid. PrimeFaces DataTable is not flexible enough to implement this level of nesting. Check this:

https://www.primefaces.org/showcase/ui/panel/panelGrid.xhtml