JBoss.org Community Documentation

- Prev
- Next

## 6.35. < rich:dataOrderedList >

### 6.35.1. Description

The component for ordered lists rendering that allows choosing data from a model and obtains built-in support of Ajax updates.

Figure 6.64. <rich:dataOderedList> component

### 6.35.2. Key Features

- A completely skinned list and child elements

- Possibility to update a limited set of rows with AJAX

- Possibility to receive values dynamically from a model

Table 6.128. rich : dataOrderedList attributes

Attribute Name | Description
--- | ---
ajaxKeys | This attribute defines row keys that are updated after an AJAX request
binding | The attribute takes a value-binding expression for a component property of a backing bean
dir | Direction indication for text that does not inherit directionality. Valid values are "LTR" (left-to-right) and "RTL" (right-to-left)
first | A zero-relative row number of the first row to display
footerClass | Space-separated list of CSS style class(es) that are be applied to any footer generated for this table
headerClass | Space-separated list of CSS style class(es) that are be applied to any header generated for this table
id | Every component may have a unique id that is automatically created if omitted
lang | Code describing the language used in the generated markup for this component
rendered | If "false", this component is not rendered
rowClasses | A comma-delimited list of CSS style classes that is applied to popup table rows. A space separated list of classes may also be specified for any individual row. The styles are applied, in turn, to each row in the table. For example, if the list has two elements, the first style class in the list is applied to the first row, the second to the second row, the first to the third row, the second to the fourth row, etc. In other words, we keep iterating through the list until we reach the end, and then we start at the beginning again
rowKey | RowKey is a representation of an identifier for a specific data row
rowKeyConverter | Converter for a RowKey object.
rowKeyVar | The attribute provides access to a row key in a Request scope
rows | A number of rows to display, or zero for all remaining rows in the table
style | CSS style(s) is/are to be applied when this component is rendered
styleClass | Corresponds to the HTML class attribute
title | Advisory title information about markup elements generated for this component
type | Corresponds to the HTML OL type attribute
value | The current value for this component
var | A request-scope attribute via which the data object for the current row will be used when iterating

Table 6.129. Component identification parameters

Name | Value
--- | ---
component-type | org.richfaces.DataOrderedList
component-class | org.richfaces.component.html.HtmlDataOrderedList
component-family | org.richfaces.DataOrderedList
renderer-type | org.richfaces.DataOrderedListRenderer
tag-class | org.richfaces.taglib.DataOrderedListTag

### 6.35.3. Creating the Component with a Page Tag

To create the simplest variant of dataOrderedList on a page, use the following syntax:

Example:

    ...

        <rich:dataOrderedList var="car" value="#{dataTableScrollerBean.allCars}" >

            <h:outputText value="#{car.model}"/>

        </rich:dataOrderedList>

    ...

### 6.35.4. Creating the Component Dynamically Using Java

Example:

    import org.richfaces.component.html.HtmlDataOrderedList;

    ...

    HtmlDataOrderedList myList = new HtmlDataOrderedList();

    ...

### 6.35.5. Details of Usage

The <rich:dataOrderedList> component allows to generate an ordered list from a model.

The component has the "type" attribute, which corresponds to the "type" parameter for the <OL> HTML element and defines a marker type. Possible values for "type" attribute are: "A", "a", "I", "i", "1".

Here is an example:

    ...

        <h:form>

            <rich:dataOrderedList var="car" value="#{dataTableScrollerBean.allCars}" rows="5" type="1"  title="Car Store">

                <h:outputText value="#{car.make} #{car.model}"/><br/>

                <h:outputText value="Price:" styleClass="label"></h:outputText>

                <h:outputText value="#{car.price}" /><br/>

                <h:outputText value="Mileage:" styleClass="label"></h:outputText>

                <h:outputText value="#{car.mileage}" /><br/>

            </rich:dataOrderedList>

        </h:form>

    ...

This is a result:

Figure 6.65. <rich:dataOrderedList> component with "type" attribute

In the example the "rows" attribute limits number of output elements of the list.

"first" attribute defines first element for output. "title" are used for popup title.

The component was created basing on the <a4j:repeat> component and as a result it could be partially updated with Ajax. "ajaxKeys" attribute allows to define row keys that are updated after an Ajax request.

Here is an example:

Example:

    ...

        <rich:dataOrderedList value="#{dataTableScrollerBean.allCars}" var="car" ajaxKeys="#{listBean.list}"

                            binding="#{listBean.dataList}" id="list">

            ...

        </rich:dataOrderedList>

    ...

        <a4j:commandButton action="#{listBean.action}" reRender="list" value="Submit"/>

    ...

In the example "reRender" attribute contains value of "id" attribute for <rich:dataOrderedList> component. As a result the component is updated after an Ajax request.

### 6.35.6. Look-and-Feel Customization

For skinnability implementation, the components use a style class redefinition method. Default style classes are mapped on skin parameters.

There are two ways to redefine the appearance of all <rich:dataOrderedList> components at once:

- Redefine the corresponding skin parameters

- Add to your style sheets style classes used by a <rich:dataOrderedList> component

### 6.35.7. Definition of Custom Style Classes

On the screenshot there are classes names that define styles for component elements.

Figure 6.66. Style classes

Table 6.130. Classes names that define a list appearance

Class name | Description
--- | ---
rich-orderedlist | Defines styles for an html <ol> element
rich-list-item | Defines styles for an html <li> element

In order to redefine styles for all <rich:dataOrderedList> components on a page using CSS, it's enough to create classes with the same names (possible classes could be found in the tables above ) and define necessary properties in them.

Example:

    ...

    .rich-orderedlist{

     background-color: #ebf3fd;

    }

    ...

This is a result:

Figure 6.67. Redefinition styles with predefined classes

In the example background color was changed.

Also it's possible to change styles of particular <rich:dataOrderedList> component. In this case you should create own style classes and use them in corresponding <rich:dataOrderedList> styleClass attributes. An example is placed below:

Example:

    ...

    .myClass{

      font-style: italic;

    }

    ...

Example:

    <rich:dataOrderedList ... styleClass="myClass"/>

This is a result:

Figure 6.68. Redefinition styles with own classes and styleClass attributes

As it could be seen on the picture above, the font style was changed.

### 6.35.8. Relevant Resources Links

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

- Prev6.34. < rich:dataList >
- Top of page
- Front page
- Next6.36. < rich:dataDefinitionList >