Search code examples
javauser-interfacejsfprimefacesicefaces

Prime faces Custom Data table inside Treetable(Matser details data)


I need custom data-table(p:datatable with different columns than parent table columns) inside tree-table. Below is image

enter image description here

I tried tree-table but in my case child row should be data-table with column headers and rows different than parent table.Also child table should have checkbox selection.

I there any JSF variant other than prime faces having ready made component mentioned as above to display master details relationship ?


Solution

  • Simply use a data table with expansion and use a child data table in the expansion. From the showcase:

    <p:dataTable var="car" value="#{dtBasicView.cars}">
        <f:facet name="header">
            Expand rows to see detailed information
        </f:facet>
        <p:column style="width:16px">
            <p:rowToggler />
        </p:column>
        <p:column headerText="Id">
            <h:outputText value="#{car.id}" />
        </p:column>
    
        <p:rowExpansion>
            <!-- Add your child data table here -->
        </p:rowExpansion>
    </p:dataTable>