12.9. <rich:dataScroller>
The
<rich:dataScroller> component is used for navigating through multiple pages of tables or grids.
12.9.1. Basic usage
The
<rich:dataScroller> must be placed in a facet of the table or grid it needs to control. Alternatively, use the for attribute to bind the parent table or grid to the scroller.
The bound table or grid should also have the
rows attribute defined to limit the number of rows per page.
The
<rich:dataScroller> component must be re-rendered whenever a filter changes on the bound table, so that the scroller matches the current model for the table.
Example 12.15. Basic usage
<rich:dataTable id="table" value="#{capitalsBean.capitals}" var="cap" rows="5"> <!-- table content --> ... </rich:dataTable> <rich:dataScroller for="table" maxPages="5"> <f:facet name="first"> <h:outputText value="First" /> </f:facet> <f:facet name="last"> <h:outputText value="Last" /> </f:facet> </rich:dataScroller>
12.9.2. Appearance and interactivity
The
page attribute is a value-binding attribute used to define and save the current page number.
The
<rich:dataScroller> component provides a range of controllers for scrolling through tables and grids:
- Controls for scrolling by a specific amount
- The component includes controls for switching to the first page, the last page, the next page, and the previous page, as well as controls for fast-forwarding or rewinding by a set amount. Use the
fastStepattribute to set the number of pages to skip when fast-forwarding or rewinding.The appearance of these controls can be customized using the following facets:first,last,next,previous,fastForward, andfastRewind. Additionally, there are facets for the controls' disabled states:first_disabled,last_disabled,next_disabled,previous_disabled,fastForward_disabled, andfastRewind_disabled. - Page controls
- The component also features a series of numbered controls to jump to a specific page. Use the
maxPagesattribute to limit the number of page controls that appear. The current page control is highlighted.
To add optional separators between controls, define the separators with the
controlsSeparator facet.
12.9.3. JavaScript API
The
<rich:dataScroller> component can be controlled through the JavaScript API. The JavaScript API provides the following functions:
switchToPage(pageIndex)- Switch to the page specified with the
pageIndexparameter. next()- Switch to the next page.
previous()- Switch to the previous page.
first()- Switch to the first page.
last()- Switch to the last page.
fastForward()- Step forward through the pages by the
fastStepamount. fastRewind()- Step backward through the pages by the
fastStepamount.
12.9.4. Reference data
component-type:org.richfaces.DataScrollercomponent-class:org.richfaces.component.UIDataScrollercomponent-family:org.richfaces.DataScrollerrenderer-type:org.richfaces.DataScrollerRendererhandler-class:org.richfaces.taglib.DataScrollerHandler
12.9.5. Style classes and skin parameters
Table 12.6. Style classes (selectors) and corresponding skin parameters
| Class (selector) | Skin Parameters | Mapped CSS properties |
|---|---|---|
| generalFamilyFont
|
font-family
|
generalSizeFont
|
font-size
| |
tableBackgroundColor
|
background
| |
| generalTextColor
|
color
|
generalFamilyFont
|
font-family
| |
generalSizeFont
|
font-size
| |
tableBorderColor
|
border-color
| |
headerBackgroundColor
|
background-color
| |
| No skin parameters. | |
| No skin parameters. | |
| No skin parameters. | |
| No skin parameters. | |
| No skin parameters. | |
| No skin parameters. | |
| generalTextColor
|
color
|
generalFamilyFont
|
font-family
| |
generalSizeFont
|
font-size
| |
tableBorderColor
|
border-color
| |
tableBackgroundColor
|
background-color
| |
| tableBorderColor
|
border-color
|
tableBackgroundColor
|
background
| |
| tableBorderColor
|
color
|
| tableBorderColor
|
color
|
