简体   繁体   English

Primefaces / JSF嵌套数据表

[英]Primefaces/JSF Nested Data Table

I have a DataModel which contains IRoomDomain objects. 我有一个包含IRoomDomain对象的DataModel。 Every IRoomDomain object has an IOccupancy array. 每个IRoomDomain对象都有一个IOccupancy数组。

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: 由于每个IRoomDomain可以具有多个IO占用率,因此我希望在IRoomDomain ID上有一个行跨度:

Var is room Var是房间

 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. 我尝试了一个嵌套的数据表(1列房间ID,1列占用数据),但它显示了每个房间的标题,而不是我想要的上方。

In addition, this construct must be selectable for the Room ID. 此外,该构造必须对于“房间ID”是可选的。

Is there any way to realize this with JSF/PrimeFaces? 有什么方法可以通过JSF / PrimeFaces来实现吗? The data model can be changed, but the relation not. 可以更改数据模型,但不能更改关系。

Thanks in advance. 提前致谢。

Yes, using PanelGrid. 是的,使用PanelGrid。 PrimeFaces DataTable is not flexible enough to implement this level of nesting. PrimeFaces DataTable不够灵活,无法实现此级别的嵌套。 Check this: 检查一下:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM