mondayguy
mondayguy

Reputation: 991

Flipped over dataTable primefaces

Is it possible to flip datatable in primefaces, in order to have headers in the left not in the top? I have following table:

<p:dataTable value="#{rolesMgmt.listOfMapsRoles}" var="map" id = "dataTable">
    <p:columns value="#{rolesMgmt.columns}" var="column">
        <f:facet name="header">
            <h:outputText value="#{column.header}" />
        </f:facet>
        <h:outputText value="#{map[column.property]}" />
    </p:columns>
</p:dataTable>

enter image description here

As you see, I have a lot of headers and 2-3 rows and I need to flip this table

Upvotes: 3

Views: 1136

Answers (2)

Kukeltje
Kukeltje

Reputation: 12335

No this is not possible by using some attribute on the p:dataTable itself. For this to be achieved you need to transpose your model. Maybe you can achieve something by manipulating the responsiveness. But if you have lots of columns AND lots of rows, maybe you should think of just displaying a 'summary' in a datatable and have a details view.

Or use a p:datagrid (showcase) where you can sort of free-format your records or a plain ui:repeat? Since you do not seem to need sorting/filtering etc in this case. The p:datatable seems overkill to me now

Upvotes: 1

Fseee
Fseee

Reputation: 2627

It's not possible to flip the table. Why don't you take a look to the ColumnToggler? You can temporarly reduce the width of the table and then, on demand, add other columns.

Upvotes: 0

Related Questions