p:table with rotated headers
Type | DOC | TXT | JPG | PNG | HEIC | SVG | ZIP | EML | |
---|---|---|---|---|---|---|---|---|---|
Primary | 8 | 4 | 8 | 8 | 7 | 8 | 2 | 0 | 4 |
Replica | 4 | 3 | 4 | 7 | 0 | 4 | 4 | 0 | 8 |
Cache | 5 | 1 | 5 | 7 | 5 | 4 | 1 | 0 | 1 |
Rotate
In some cases, often when the cell content is only a single number, but the label of the table header have many character, it's easy to optimise the layout and safe space in rotating the table headers. This is achieved with the styleClass="jeeslDtThVertical" .
<p:dataTable var="r" value="#{styleTableRotateBean.rows}" styleClass="jeesl-datatable">
<f:facet name="header">
<j:dtHeader title="p:table with rotated headers"/>
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column colspan="1" headerText="Type" />
<p:columns var="c" value="#{styleTableRotateBean.columnsA}">
<f:facet name="header">
<h:outputText value="#{c.name[localeCode].lang}"/>
</f:facet>
</p:columns>
<p:columns var="c" value="#{styleTableRotateBean.columnsB}"
styleClass="jeesl-datatable-header-vertical" >
<f:facet name="header">
<h:outputText value="#{c.name[localeCode].lang}"/>
</f:facet>
</p:columns>
</p:row>
</p:columnGroup>
<p:column rendered="true">
<h:outputText value="#{r.name[localeCode].lang}"/>
</p:column>
<p:columns var="c" value="#{styleTableRotateBean.columnsA}"
styleClass="jeeslCenter">
<h:outputText value="#{styleTableRotateBean.map[r][c]}"/>
</p:columns>
<p:columns var="c" value="#{styleTableRotateBean.columnsB}"
styleClass="jeeslCenter">
<h:outputText value="#{styleTableRotateBean.map[r][c]}"/>
</p:columns>
</p:dataTable>