Kush Sahu
Kush Sahu

Reputation: 399

How can I use nested datatable rowExpansion of primefaces?

Hi I have a datatable suppose office. Inside that datatable I have datatable department.

After clicking of rowtoggler of office datatable I show information related to office and respected department table. And I want after clicking rowtoggler of department datatable I can get information related to department.

But even after clicking rowtoggler of department datatable I get info of office and department table again, added to bottom.

I guess its calling same method which it calls for office datatable.

<p:dataTable id="officeDataTable" value="#{mybean.officeList}">
   <p:column>...</p:column>
   <p:column>...</p:column>
   <p:column>...</p:column>
   <p:column><p:rowToggler/></p:column>
   <p:rowExpansion>
        .....
        .....
        .....
        <p:dataTable id="departmentDataTable" value="#{mybean.officeList.departmentList}">
           <p:column>...</p:column>
           <p:column>...</p:column>
           <p:column>...</p:column>
           <p:column><p:rowToggler/></p:column>
           <p:rowExpansion>
               .....
               .....
               .....
           </p:rowExpansion>
        </p:dataTable>
   </p:rowExpansion>
</p:dataTable>

Upvotes: 0

Views: 8556

Answers (1)

Emil Kaminski
Emil Kaminski

Reputation: 1885

There seems to be an issue with nested datatables, with a possible solution found here:

https://code.google.com/archive/p/primefaces/issues/1727

You also might want to consider using a treetable instead:

Primefaces TreeTable

Upvotes: 2

Related Questions