Search code examples
jsfprimefacesdatatablerowexpansion

p:rowExpansion looks like another row of main p:dataTable


Is there any simple way to unify look of dataTable inside rowExpansion and main dataTable? Or dou you have any ideas to make it nice? I want it to looks like hidden rows of the same dataTable. Here is how it looks by default:

enter image description here

And here is default xhtml code:

<p:dataTable id="cars" var="car" value="#{carBean.someList}">
    <f:facet name="header">
        List of Cars
    </f:facet>

    <p:column style="width:16px">
        <p:rowToggler />
    </p:column>

    <p:column headerText="Name">
        <h:outputText value="#{car.user.name}" />
    </p:column>

    <p:columns value="#{scoresBean.otherList}" var="score" columnIndexVar="colIndex">
        <f:facet name="header">
            <h:outputText value="#{colIndex+1}" />
        </f:facet>
        <h:outputText value="#{car.scores[colIndex]}" />
    </p:columns>

    <p:rowExpansion>
        <p:dataTable id="cycs" var="cyc" value="#{car.semiScoresList}">
            <p:column>
                <h:outputText value="#{cyc.partName}" />
            </p:column>

            <p:columns value="#{scoresBean.otherList}" var="score" columnIndexVar="col">
                <h:outputText value="#{cyc.partsScores[col]}" />
            </p:columns>
        </p:dataTable>
    </p:rowExpansion>
</p:dataTable>

Solution

  • You can't, not without a lot of css javascript etc. Use a p:treetable for this