DataGrid

DataGrid displays a collection of data in grid layout. Ajax Pagination is a built-in feature and paginator UI is fully customizable via various options like paginatorTemplate, rowsPerPageOptions, pageLinks and more.

(1 of 5) pp12345pp
bbf9d6fc
1965
8fa317a0
1969
c909de32
2005
1c1a1b5d
2007
45c9d878
1984
e2006745
2004
74de62dc
1981
14209d5b
1987
756344d3
2003
65e3f554
2005
1a42b716
2008
ab67f4f0
1997
(1 of 5) pp12345pp
Car Detail

Source

<h:form id="form">

	<p:dataGrid var="car" value="#{tableBean.cars}" columns="3"
		rows="12" paginator="true"
		paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
		rowsPerPageTemplate="9,12,15">
		
		<p:column>
			<p:panel header="#{car.model}" style="text-align:center">
				<h:panelGrid columns="1" style="width:100%">
					<p:graphicImage value="/images/cars/#{car.manufacturer}.jpg"/> 
				
					<h:outputText value="#{car.year}" />
					
					<p:commandLink update=":form:carDetail" oncomplete="carDialog.show()" title="View Detail">
						<p:graphicImage value="/images/search.png"/> 
						<f:setPropertyActionListener value="#{car}" 
								target="#{tableBean.selectedCar}" />
					</p:commandLink>
				</h:panelGrid>
			</p:panel>
		</p:column>

	</p:dataGrid>
	
	<p:dialog p:dialog header="Car Detail" widgetVar="carDialog" modal="true">
		<p:outputPanel id="carDetail" style="text-align:center;" layout="block">
		
			<p:graphicImage value="/images/cars/#{tableBean.selectedCar.manufacturer}.jpg"/>
			
			<h:panelGrid  columns="2" cellpadding="5">
				<h:outputLabel for="modelNo" value="Model No: " />
				<h:outputText id="modelNo" value="#{tableBean.selectedCar.model}" />
				
				<h:outputLabel for="year" value="Year: " />
				<h:outputText id="year" value="#{tableBean.selectedCar.year}" />
				
				<h:outputLabel for="color" value="Color: " />
				<h:outputText id="color" value="#{tableBean.selectedCar.color}" style="color:#{tableBean.selectedCar.color}"/>
			</h:panelGrid>
		</p:outputPanel>
	</p:dialog>

</h:form>