primefacesdatatable

Primefaces SubTable within subTable


I am trying to build a primefaces datatable which has multiple subtables.

The relationship is as below.

Supplier can have multiple Purchase Orders. Purchase Orders can have multiple Lines for the same Purchase Order.

I have following VO.

  1. Supplier
  2. Purchase Order Header
  3. Purchase Order Lines

I have one final VO which holds List of all above VOs.

SupplierPOView

public List<Supplier> supplier;
public List<POHeader> poHeader;
public List<POLine>   poLine;

I have myBatis and corresponding mapper which maps and stores the above information in List object of

public List<SupplierPOView> supplierPOViewList;

supplierPOViewList has getter and setter.

But not sure how to represent this in primefaces datatable.

I am after where Supplier is the top level then it shows the PO Header information and then the PO Line.

can you please help.

Thanks


Solution

  • Use <p:dataGrid /> for Supplier.

    Then inside datagrid ,use <p:dataTable> for PO Header information and then for PO Line

    use p:subTable (inside the datatable).

    DataGrid

    DataTable

    SubTable