Referring to this post on primefaces forum.
Has someone got any idea how can we use multiple datatable on the same page but only display the correct one?
My problem is that i have a view-Scoped bean whose properties contain data from different tables from a database. I have multiple datatables for data of each database table. Now i want to display the datatable on the basis value selected from <p:selectOneMenu> (encircled in red color).
this screenshot would explain a bit further.
Referring to this post on primefaces forum. Has someone got any idea how can
Share

The basic approach would be to let the
renderedattribute of the tables depend on the selected item of the menu.This is easy to implement, but you end up with a lot of code in the view (which can of course be split over
<ui:include>files). The more advanced and reuseable approach would be to let thevalueof the single table depend on the selected item of the menu and use<p:columns>to generate columns dynamically.with something like:
This only allows less fine-grained control whenever you want to add more specialized columns. You’d probably want to work with tag files instead.