Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Description
Key Features
Details of Usage
Reference Data
Relevant Resources Links
6.6.9.1. Description
The component designed for providing the functionality of tables scrolling using Ajax
requests.
of
fast
Example:
...
<rich:datascroller for="table" maxPages="10">
<f:facet name="first">
<h:outputText value="First"/>
</f:facet>
<f:facet name="last">
<h:outputText value="Last"/>
</f:facet>
</rich:datascroller>
...
customization
the
additional "fastStep" attribute is used. The attribute indicates pages quantity to switch onto
when fast scrolling is used.
The "page" is a value-binding attribute used to define and save the current page number.
The example is placed below.
Example:
...
<h:form id="myForm">
<rich:dataTable id="carList" rows="7" value="#{dataTableScrollerBean.allCars}" var="category">
<f:facet name="header">
<rich:columnGroup>
<h:column>
<h:outputText value="Make" />
</h:column>
<h:column>
<h:outputText value="Model" />
</h:column>
<h:column>
<h:outputText value="Price" />
</h:column>
</rich:columnGroup>
</f:facet>
<h:column>
<h:outputText value="#{category.make}" />
</h:column>
<h:column>
<h:outputText value="#{category.model}" />
</h:column>
<h:column>
<h:outputText value="#{category.price}" />
</h:column>
</rich:dataTable>
<rich:datascroller id="sc2" for="carList" reRender="sc1" maxPages="7" page="#{dataTableScroll
erBean.scrollerPage}" />
<h:panelGrid>
<h:panelGroup>
<h:outputText value="Set current page number:" />
<h:inputText value="#{dataTableScrollerBean.scrollerPage}" id="sc1" size="1"/>
<h:commandButton value="Set" />
</h:panelGroup>
</h:panelGrid>
</h:form>
...
In the example above you can enter the page number you want and set it by clicking on
the <h:commandButton> . By the way, if you use<rich:datascroller> page links the
input field rerenders and current page number changes.
The result should be like below:
The "pageIndexVar" and "pagesVar" attributes define a request scope variables and provide
an ability to show the current page and the number of pages in the <rich:datascroller> .
These attributes are used for definition the names of variables, that is used in the facet with
name "pages" . An example can be found below:
Example:
...
<h:form>
<rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5">
<rich:column>
<h:outputText value="#{cap.name}" />
</rich:column>
<f:facet name="footer">
<rich:datascroller pageIndexVar="pageIndex" pagesVar="pages">
<f:facet name="pages">
<h:outputText value="#{pageIndex} / #{pages}" />
</f:facet>
</rich:datascroller>
</f:facet>
</rich:dataTable>
</h:form>
...
It's possible to insert optional separators between controls. For this purpose use
a "controlsSeparator" facet. An example is placed below.
...
<f:facet name="controlsSeparator">
<h:graphicImage value="/image/sep.png"/>
</f:facet>
...
Starting from 3.2.1 of RichFaces multiple <rich:datascroller> instances behavior and page
bindings are corrected. Incorrect page after model changes handling is added. Phase Listener
called before RenderResponce scans the page for the <rich:datascroller> and performs the
following operations:
o
attached
gets
the
value
of
the
to
page
which
attribute
Information about the "process" attribute usage you can find in the " Decide what to process
" guide section.
Note:
Make sure, that all <rich:datascroller> components, defined for a table, have same values
for all "page" attributes. The page, specified in the last "page" , will be rendered in browser.
Name
Value
component-type
org.richfaces.Datascroller
component-class
org.richfaces.component.html.HtmlDatascroller
component-family
org.richfaces.Datascroller
renderer-type
org.richfaces.DataScrollerRenderer
tag-class
org.richfaces.taglib.DatascrollerTag
Function
Description
switchToPage(page
)
next()
previous()
first()
last()
fastForward()
Navigates ahead over a certain number of pages. The number of pages to traverse is
defined with fastStep attribute
fastRewind()
Navigates backwards over a certain number of pages. The number of pages to traverse is
defined with fastStep attribute
Facet
Description
controlsSeparator
first
first_disabled
last
last_disabled
fastrewind
fastrewind_disabled
fastforward
fastforward_disabled
previous
previous_disabled
next
next_disabled
pages
Table 6.49. Style classes (selectors) with the corresponding skin parameters
Class (selector)
name
.rich-datascr-button
.rich-datascr-ctrlsseparator
Description
Skin Parameters
CSS properties
mapped
additionalBackgroundCol
or
background-color
panelBorderColor
border-color
panelBorderColor
border-color
generalFamilyFont
font-family
generalSizeFont
font-size
additionalBackgroundCol
or
background-color
panelBorderColor
border-color
panelBorderColor
border-color
generalFamilyFont
font-family
Class (selector)
name
.rich-datascrbutton-dsbld
.rich-datascr-act
.rich-datascr-inact
.rich-dtascrollertable
Description
Skin Parameters
CSS properties
mapped
generalSizeFont
font-size
panelBorderColor
color
generalTextColor
border-top-color,
color
generalFamilyFont
font-family
generalSizeFont
font-size
headerBackgroundColor
border-top-color,
color
generalFamilyFont
font-family
generalSizeFont
font-size
panelBorderColor
border-color
tableBackgroundColor
background-color
Class name
Description
.rich-datascr
You can find all necessary information about style classes redefinition in Definition of Custom
Style Classes section.
to
problem
Here you can find out how to use pair of <rich:datascrollers> outside the any dataTable.
The solution about how to make <rich:datascroller> be updated after sorting/filtering can
be found on Data Iteration Components FAQ.