Code: Select all
<p:dataTable id="table" var="item" widgetVar="table"
value="#{bean.items}" rows="50"
paginator="true" pageLinks="4"
paginatorTemplate="{RowsPerPageInputText} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {CurrentPageReport} {Exporters}"
rowsPerPageTemplate="50" paginatorPosition="bottom" sortMode="single">
<p:columns value="#{bean.columns}" var="column"
columnIndexVar="colIndex" headerText="#{column.header}" sortBy="#{item.values[column.index]}">
<h:outputText value="#{item.values[column.index]}" rendered="#{!column.dateValue}" />
<h:outputText value="#{item.changeDate.time}" rendered="#{column.dateValue}"/>
</p:columns>
</p:dataTable>
Code: Select all
public class Items {
protected String[] values;
protected List<DataVO> extraData;
protected Calendar date;
// GETTERS
}
Columns model
Code: Select all
public class ColumnModel {
protected String header;
protected String property;
protected int index;
protected boolean dateValue;
// GETTERS
}