6.28.  < rich:dataFilterSlider >

6.28.1. Description

A slider-based action component is used for filtering table data.

<rich:dataFilterSlider> component

Figure 6.28.  <rich:dataFilterSlider> component


6.28.2. Key Features

  • Filter any UIData based component in dependency on its child's values

  • Fully skinnable control and input elements

  • Optional value text field with an attribute-managed position

  • Optional disablement of the component on a page

  • Optional toolTip to display the current value while a handle is dragged

  • Dragged state is stable after the mouse moves

  • Optional manual input possible if a text input field is present

  • Validation of manual input

Table 6.107. rich : dataFilterSlider attributes

Attribute NameDescription
actionMethodBinding pointing at the application action to be invoked, if this UIComponent is activated by you, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of the immediate property
actionListenerMethodBinding pointing at method accepting an ActionEvent with return type void
ajaxSingleif "true", submits ONLY one field/link, instead of all form controls
bindingThe attribute takes a value-binding expression for a component property of a backing bean
bypassUpdatesIf "true", after process validations phase it skips updates of model beans on a force render response. It can be used for validating components input
clientErrorMessageAn error message to use in client side validation events
dataSerialized (on default with JSON) data passed on the client by a developer on AJAX request. It's accessible via "data.foo" syntax
endRangeA slider end point
eventsQueueName of requests queue to avoid send next request before complete other from same event. Can be used to reduce number of requests of frequently events (key press, mouse move etc.)
fieldStyleClassThe styleClass for input that displays the value : 'manualInput' must be true
filterByA getter of an object member required to compare a slider value to. This is a value that is used in results filtering
focusid of element to set focus after request completed on client side
forThe component using UIData (datatable id)
forValRefThis is a string which is used in a value attribute of the datatable. It is used for resetting the datatable back to the original list provided by a backing bean
handleStyleClassThe handleStyleClass for a handle
handleValueCurrent handle value
idEvery component may have a unique id that is automatically created if omitted
ignoreDupResponsesAttribute allows to ignore an Ajax Response produced by a request if the newest 'similar' request is in a queue already. ignoreDupResponses="true" does not cancel the request while it is processed on the server, but just allows to avoid unnecessary updates on the client side if the response isn't actual now
immediateTrue means, that the default ActionListener should be executed immediately (i.e. during Apply Request Values phase of the request processing lifecycle), rather than waiting until the Invoke Application phase
incrementAmount to which a handle on each slide/move should be incremented
limitToListIf "true", updates on client side ONLY elements from this 'reRender' property. If "false" (default) updates all rendered by ajax region components
manualInputFalse value for this attribute makes text field "read-only" and "hidden". Hence, the value can be changed only from a handle
onbeforedomupdateJavaScript code for call before DOM has been updated on client side
onchangeEvent occur on chage
onclickHTML: a script expression; a pointer button is clicked
oncompleteJavaScript code for call after request completed on client side
ondblclickHTML: a script expression; a pointer button is double-clicked
onerrorHTML: a script expression; event fires whenever an JavaScript error occurs
onkeydownHTML: a script expression; a key is pressed down
onkeypressHTML: a script expression; a key is pressed and released
onkeyupHTML: a script expression; a key is released
onmousedownHTML: script expression; a pointer button is pressed down
onmousemoveHTML: a script expression; a pointer is moved within
onmouseoutHTML: a script expression; a pointer is moved away
onmouseoverHTML: a script expression; a pointer is moved onto
onmouseupHTML: script expression; a pointer button is released
onslideEvent occur on sliding
onSlideSubmitIf the slider value changes must submit a form, onSlideSubmit can be true
processId['s] (in format of call UIComponent.findComponent()) of components, processed at the phases 2-5 in case of AjaxRequest caused by this component. Can be single id, comma-separated list of Id's, or EL Expression with array or Collection
rangeStyleClassThe rangeStyleClass for the background div showing a full range
renderedIf "false", this component is not rendered
requestDelayAttribute defines the time (in ms.) that the request will be wait in the queue before it is ready to send. When the delay time is over, the request will be sent to the server or removed if the newest 'similar' request is in a queue already
reRenderId['s] (in format of call UIComponent.findComponent()) of components, rendered in case of AjaxRequest caused by this component. Can be single id, comma-separated list of Id's, or EL Expression with array or Collection
sliderListenerMethodBinding representing an action listener method that will be notified after changing of slider control position
startRangeA slider begin point
statusID (in format of call UIComponent.findComponent()) of Request status component
storeResultsSpecifies if the component will store a UIData object (your table rows) in session
styleCSS style(s) is/are to be applied when this component is rendered
styleClassThe styleClass for the container div surrounding the component
timeoutResponse waiting time on a particular request. If a response is not received during this time, the request is aborted
trackStyleClassThe trackStyleClass for a background div
trailerIt shows or hides a trailer following a handle
trailerStyleClassThe trailerStyleClass for a div following a handle
valueThe current value for this component
widthWidth of the slider control

Table 6.108. Component identification parameters

NameValue
component-typeorg.richfaces.dataFilterSlider
component-classorg.richfaces.component.html.HtmlDataFilterSlider
component-familyorg.richfaces.DataFilterSlider
renderer-typeorg.richfaces.DataFilterSliderRenderer
tag-classorg.richfaces.taglib.dataFilterSliderTag

6.28.3. Creating the Component with a Page Tag

Here is a simple example as it could be used on a page:

Example:


...
    <rich:dataFilterSlider sliderListener="#{mybean.doSlide}" startRange="0"
                                            endRange="50000" increment="10000" handleValue="1" />
...

6.28.4. Creating the Component Dynamically Using Java

Example:


import org.richfaces.component.html.HtmlDataFilterSlider;   
...
HtmlDataFilterSlider mySlider = new HtmlDataFilterSlider();
...

6.28.5. Details of Usage

The dataFilterSlider component is bound to some UIData component using a "for" attribute and filters data in a table.

Example:


...
    <rich:dataFilterSlider sliderListener="#{mybean.doSlide}"
                        startRange="0"
                        endRange="50000"
                        increment="10000"
                        handleValue="1"
                        for="carIndex"
                        forValRef="inventoryList.carInventory" 
                        filterBy="getMileage"
    />
...
    <h:dataTable id="carIndex"> 
        ... 
    </h:dataTable>
...

In this example other two attributes are used for filtering:

  • "forValRef" is a string which is used in a value attribute of the target UIData component. It's designed for resetting the UIData component back to the original list provided by a backing bean.

  • "filterBy" is a getter of an object member that is to be compared to a slider value. It's a value that is used in results filtering.

"handleValue" is an attribute for keeping the current handler position on the dataFilterSlider component. Based on the current value, appropriate values obtained from a getter method defined in "filterBy" are filtered.

One more important attribute is a "storeResults" one that allows the dataFilterSlider component to keep UIData target object in session.

If it's necessary the component submits a form on event of a handler state changing, use the "onSlide" attribute ( "onChange" is its alias). When the attribute definition = true, submission on this event is defined.

Information about the "process" attribute usage you can find here.

6.28.6. Look-and-Feel Customization

The <rich:dataFilterSlider> component has no skin parameters and special style classes , as it consists of one element generated with a your method on the server. To define some style properties such as an indent or a border, it's possible to use "style" and "styleClass" attributes on the component.

6.28.7. Relevant Resources Links

Here you can see the example of <rich:dataFilterSlider> usage and sources for the given example.