JBoss.orgCommunity Documentation
The component is meant for rendering tables. It allows choosing data from a model and obtains built-in support of Ajax updates.
The <rich:dataTable> component is similar to the <h:dataTable> one, except Ajax support and skinnability. Ajax support is possible, because the component was created basing on the <a4j:repeat> component and as a result it could be partially updated with Ajax. The "ajaxKeys" attribute allows to define row keys which are updated after an Ajax request. You can find an example which demonstrate the usage of the "ajaxKeys" attributes for data iteration components in the RichFaces Cookbook article.
The component allows to use "header" , "footer" and "caption" facets for output. See an example below:
Example:
...
<rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5">
<f:facet name="caption">
<h:outputText value="United States Capitals" />
</f:facet>
<f:facet name="header">
<h:outputText value="Capitals and States Table" />
</f:facet>
<rich:column>
<f:facet name="header">State Flag</f:facet>
<h:graphicImage value="#{cap.stateFlag}"/>
<f:facet name="footer">State Flag</f:facet>
</rich:column>
<rich:column>
<f:facet name="header">State Name</f:facet>
<h:outputText value="#{cap.state}"/>
<f:facet name="footer">State Name</f:facet>
</rich:column>
<rich:column >
<f:facet name="header">State Capital</f:facet>
<h:outputText value="#{cap.name}"/>
<f:facet name="footer">State Capital</f:facet>
</rich:column>
<rich:column>
<f:facet name="header">Time Zone</f:facet>
<h:outputText value="#{cap.timeZone}"/>
<f:facet name="footer">Time Zone</f:facet>
</rich:column>
<f:facet name="footer">
<h:outputText value="Capitals and States Table" />
</f:facet>
</rich:dataTable>
...
This is a result:
Information about sorting and filtering you can find in the corresponding section.
You can find information how to remove header's gradient in the "How to remove rich:dataTable header background " article.
Table of <rich:dataTable> attributes.
Table 6.49. Component Identification Parameters
Name | Value |
---|---|
component-type | org.richfaces.DataTable |
component-class | org.richfaces.component.html.HtmlDataTable |
component-family | org.richfaces.DataTable |
renderer-type | org.richfaces.DataTableRenderer |
tag-class | org.richfaces.taglib.DataTableTag |
Table 6.50. Facets
Facet | Description |
---|---|
header | Redefines the header content |
footer | Redefines the footer content |
caption | Defines the caption content |
Table 6.51. Classes names that define a whole component appearance
Class name | Description |
---|---|
rich-table | Defines styles for all table |
rich-table-caption | Defines styles for a "caption" facet element |
Table 6.52. Classes names that define header and footer elements
Class name | Description |
---|---|
rich-table-header | Defines styles for a table header row |
rich-table-header-continue | Defines styles for all header lines after the first |
rich-table-subheader | Defines styles for a column header |
rich-table-footer | Defines styles for a footer row |
rich-table-footer-continue | Defines styles for all footer lines after the first |
rich-table-subfooter | Defines styles for a column footer |
Table 6.53. Classes names that define rows and cells of a table
Class name | Description |
---|---|
rich-table-headercell | Defines styles for a header cell |
rich-table-subheadercell | Defines styles for a column header cell |
rich-table-cell | Defines styles for a table cell |
rich-table-row | Defines styles for a table row |
rich-table-firstrow | Defines styles for a table's first row |
rich-table-footercell | Defines styles for a footer cell |
rich-table-subfootercell | Defines styles for a column footer cell |
On the component LiveDemo page you can see the example of <rich:dataTable> usage and sources for the given example.
The article about <rich:dataTable> flexibility can be found in the "rich:dataTable Flexibility " article .
Article on dataTable skinability provides you a simple example of skinnability.
More information about using <rich:dataTable> and <rich:subTable> could be found on the RichFaces Users Forum.
How to use <rich:dataTable> and <rich:datascroller> in a context of Extended Data Model see on the RichFaces Users Forum.
From "rich:dataTable border to 0px " article you'll figure out how to set rich:dataTable border to 0px
dataTable Background Out tells you how to remove rich:dataTable header background