12.7. <rich:dataGrid>
The
<rich:dataGrid> component is used to arrange data objects in a grid. Values in the grid can be updated dynamically from the data model, and Ajax updates can be limited to specific rows. The component supports header, footer, and caption facets.
The
<rich:dataGrid> component is similar in function to the JavaServer Faces <h:panelGrid> component. However, the <rich:dataGrid> component additionally allows iteration through the data model rather than just aligning child components in a grid layout.
12.7.1. Basic usage
The
<rich:dataGrid> component requires the value attribute, which points to the data model, and the var attribute, which holds the current variable for the collection of data.
12.7.2. Customizing the grid
The number of columns for the grid is specifed with the
columns attribute, and the number of elements to layout among the columns is determined with the elements attribute. The first attribute references the zero-based element in the data model from which the grid starts.
Example 12.12. <rich:dataGrid> example
<rich:panel style="width:150px;height:200px;"> <h:form> <rich:dataGrid value="#{dataTableScrollerBean.allCars}" var="car" columns="2" elements="4" first="1"> <f:facet name="header"> <h:outputText value="Car Store"></h:outputText> </f:facet> <rich:panel> <f:facet name="header"> <h:outputText value="#{car.make} #{car.model}"></h:outputText> </f:facet> <h:panelGrid columns="2"> <h:outputText value="Price:" styleClass="label"></h:outputText> <h:outputText value="#{car.price}"/> <h:outputText value="Mileage:" styleClass="label"></h:outputText> <h:outputText value="#{car.mileage}"/> </h:panelGrid> </rich:panel> <f:facet name="footer"> <rich:dataScroller></rich:dataScroller> </f:facet> </rich:dataGrid> </h:form> </rich:panel>
12.7.3. Partial updates
As
<rich:dataGrid> the component is based on the <a4j:repeat> component, it can be partially updated with Ajax. Refer to Section 12.1.2, “Limited views and partial updates” for details on partially updating the <rich:dataGrid> component.
12.7.4. Reference data
component-type:org.richfaces.DataGridcomponent-class:org.richfaces.component.UIDataGridcomponent-family:org.richfaces.Datarenderer-type:org.richfaces.DataGridRendererhandler-class:org.richfaces.taglib.DataGridHandler
12.7.5. Style classes and skin parameters
Table 12.4. Style classes (selectors) and corresponding skin parameters
| Class (selector) | Skin Parameters | Mapped CSS properties |
|---|---|---|
| tableBackgroundColor
|
background-color
|
tableBorderWidth
|
border-left-width, border-top-width
| |
tableBorderColor
|
border-left-color, border-top-color
| |
| No skin parameters. | |
| No skin parameters. | |
| tableBorderWidth
|
border-bottom-width, border-right-width
|
tableBorderColor
|
border-bottom-color, border-right-color
| |
generalTextColor
|
color
| |
generalFamilyFont
|
font-family
| |
generalSizeFont
|
font-size
| |
| tableBorderWidth
|
border-bottom-width, border-right-width
|
tableBorderColor
|
border-bottom-color, border-right-color
| |
generalTextColor
|
color
| |
generalFamilyFont
|
font-family
| |
generalSizeFont
|
font-size
| |
| tableBorderWidth
|
border-bottom-width
|
tableBorderColor
|
border-bottom-color
| |
| No skin parameters. | |
| No skin parameters. | |
| No skin parameters. | |
| tableHeaderBackgroundColor
|
background-color
|
tableBorderWidth
|
border-bottom-width, border-right-width
| |
tableBorderColor
|
border-bottom-color, border-right-color
| |
tableHeaderTextColor
|
color
| |
generalFamilyFont
|
font-family
| |
generalSizeFont
|
font-size
| |
| No skin parameters. | |
| No skin parameters. | |
| tableFooterBackgroundColor
|
background-color
|
tableBorderWidth
|
border-bottom-width, border-right-width
| |
tableBorderColor
|
border-bottom-color, border-right-color
| |
generalTextColor
|
color
| |
generalFamilyFont
|
font-family
| |
generalSizeFont
|
font-size
| |

