Primefaces p:dataTable with dynamic columns



<p:dataTable rendered="true" sortBy="#{record.column1}" value="#{tableGenerator.dataTable.records}" var="record"
		id="tblResult" paginator="true" rows="10" style="font-size:9px;"
		rowKey="#{record.column1}">
		<f:facet name="header">
			<h:outputText style="text-align:left!important;color:green;"
				value="Total Record size (#{tableGenerator.dataTable.recordsSize} records)" />
		</f:facet>
		<c:forEach var="column" items="#{tableGenerator.dataTable.columnArr}">
			<p:column sortBy="#{record[column]}" filterBy="#{record[column]}">
				<f:facet name="header">
					<h:outputText value="#{column}" />
				</f:facet>
				<h:outputText value="#{record[column]}" />
			</p:column>
		</c:forEach>
	</p:dataTable>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s