Send your remarks, comments or wishes to doc team
Subject:
Message:
Your name:
Your email:

JBoss.org Community Documentation

- Prev
- Next

## 6.51. < rich:extendedDataTable >

### 6.51.1. Description

## Note:

The component is in a preview state for 3.2.2 release because it was not fully tested and reviewed by the RF team.

The component for tables extending standard component <rich:dataTable> .

Figure 6.102. <rich:extendedDataTable> component

### 6.51.2. Key Features

- Possibility to scroll data

- Possibility to add an attribute to set the kind of selection (none, single line or multiple lines)

- Possibility to change the sequence of the displayed columns by dragging the column-header to another position

- Possibility to show or hide columns by selecting or deselecting them in a context menu

- Possibility to save the current settings (visible columns, column width, sequence of the columns) to be reused the next time the page will be shown

- Possibility to combine rows to groups

Table 6.183. rich : extendedDataTable attributes

Attribute Name | Description
--- | ---
activeClass | CSS class for active row
activeRowKey | Request scope attribute under which the activeRowKey will be accessible
ajaxKeys | This attribute defines row keys that are updated after an AJAX request
align | Deprecated. This attribute specifies the position of the table with respect to the document. The possible values are "left", "center" and "right". The default value is "left".
bgcolor | Deprecated. This attribute sets the background color for the document body or table cells. This attribute sets the background color of the canvas for the document body (the BODY element) or for tables (the TABLE, TR, TH, and TD elements). Additional attributes for specifying text color can be used with the BODY element. This attribute has been deprecated in favor of style sheets for specifying background color information
binding | The attribute takes a value-binding expression for a component property of a backing bean
border | This attributes specifies the width of the frame around a component
captionClass | Space-separated list of CSS style class(es) that are be applied to caption for this component
captionStyle | CSS style(s) is/are to be applied to caption when this component is rendered
cellpadding | This attribute specifies the amount of space between the border of the cell and its contents
cellspacing | This attribute specifies the amount of space between the border of the cell and its contents. The attribute also specifies the amount of space to leave between cells
columnClasses | Comma-delimited list of CSS style classes that are be applied to the columns of this table. A space separated list of classes may also be specified for any individual column. If the number of elements in this list is less than the number of columns specified in the "columns" attribute, no "class" attribute is output for each column greater than the number of elements in the list. If the number of elements in the list is greater than the number of columns specified in the "columns" attribute, the elements at the position in the list after the value of the "columns" attribute are ignored
componentState | It defines EL-binding for a component state for saving or redefinition
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 footer for this component
frame | This attribute specifies which sides of the frame surrounding a table will be visible. Possible values: "void", "above", "below", "hsides", "lhs", "rhs", "vsides", "box" and "border". The default value is "void".
groupingColumn | Defines an id of column which the data is grouped by.
headerClass | Space-separated list of CSS style class(es) that are be applied to header for this component
height | Defines a height of the component. Default value is 500px
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
onclick | HTML: a script expression; a pointer button is clicked
ondblclick | HTML: a script expression; a pointer button is double-clicked
onkeydown | HTML: a script expression; a key is pressed down
onkeypress | HTML: a script expression; a key is pressed and released
onkeyup | HTML: a script expression; a key is released
onmousedown | HTML: script expression; a pointer button is pressed down
onmousemove | HTML: a script expression; a pointer is moved within
onmouseout | HTML: a script expression; a pointer is moved away
onmouseover | HTML: a script expression; a pointer is moved onto
onmouseup | HTML: script expression; a pointer button is released
onRowClick | HTML: a script expression; a pointer button is clicked on row
onRowDblClick | HTML: a script expression; a pointer button is double-clicked on row
onRowMouseDown | HTML: script expression; a pointer button is pressed down on row
onRowMouseMove | HTML: a script expression; a pointer is moved within of row
onRowMouseOut | HTML: a script expression; a pointer is moved away of row
onRowMouseOver | HTML: a script expression; a pointer is moved onto of row
onRowMouseUp | HTML: script expression; a pointer button is released on row
onselectionchange | HTML: script expression to invoke on changing of rows selection
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
rowKeyConverter | Converter for a row key 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
rules | This attribute specifies which rules will appear between cells within a table. The rendering of rules is user agent dependent. Possible values: * none: No rules. This is the default value. * groups: Rules will appear between row groups (see THEAD, TFOOT, and TBODY) and column groups (see COLGROUP and COL) only. * rows: Rules will appear between rows only. * cols: Rules will appear between columns only. * all: Rules will appear between all rows and columns
selectedClass | CSS class for selected rows
selection | Value binding representing selected rows
selectionMode | single [default]: Single row can be selected. multi: Multiple rows can be selected. none: no rows can be selected.
sortMode | Defines mode of sorting. Possible values are 'single' for sorting of one column and 'multi' for some.
sortPriority | Defines a set of column ids in the order the columns could be set
stateVar | The attribute provides access to a component state on the client side
style | CSS style(s) is/are to be applied when this component is rendered
styleClass | Corresponds to the HTML class attribute
tableState | ValueBinding pointing at a property of a String to hold table state
title | Advisory title information about markup elements generated for this component
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
width | This attribute specifies the desired width of the entire table and is intended for visual user agents. When the value is percentage value, the value is relative to the user agent's available horizontal space. In the absence of any width specification, table width is determined by the user agent

Table 6.184. Component identification parameters

Name | Value
--- | ---
component-type | org.richfaces.ExtendedDataTable
component-class | org.richfaces.component.html.HtmlExtendedDataTable
component-family | org.richfaces.ExtendedDataTable
renderer-type | org.richfaces.ExtendedDataTableRenderer
tag-class | org.richfaces.taglib.ExtendedDataTableTag

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

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

Example:

    ...

    <rich:extendedDataTable value="#{extendedDT.dataModel}" var="edt">

           <rich:column>

             ...

           </rich:column>

    </rich:extendedDataTable>

    ...

### 6.51.4. Creating the Component Dynamically from Java

Example:

    import org.richfaces.component.html.HtmlExtendedDataTable;

    ...

    HtmlExtendedDataTable myTable = new HtmlExtendedDataTable();

    ...

### 6.51.5. Details of Usage

The <rich:extendedDataTable> component is similar to the <rich:dataTable> . The data in component is scrollable. You can also set the type of selection ( "none", "single" or "multi" lines). Selection of multiple lines is possible using Shift and Ctrl keys.

Here is an example:

Example:

    ...

    <rich:extendedDataTable id="edt" value="#{extendedDT.dataModel}" var="edt" width="500px" height="500px" selectedClass="dataTableSelectedRow" sortMode="single" selectionMode="multi" selection="#{extendedDT.selection}" rowKeyVar="rkvar" tableState="#{extendedDT.tableState}">

           <rich:column id="id" headerClass="dataTableHeader" width="50" label="Id" sortable="true" sortBy="#{edt.id}" sortIconAscending="dataTableAscIcon" sortIconDescending="dataTableDescIcon">

                  <f:facet name="header">

                         <h:outputText value="Id" />

                  </f:facet>

                  <h:outputText value="#{edt.id}" />

           </rich:column>

           <rich:column id="name" width="300" headerClass="dataTableHeader" label="Name" sortable="true" sortBy="#{edt.name}" sortIconAscending="dataTableAscIcon" sortIconDescending="dataTableDescIcon" filterBy="#{edt.name}" filterEvent="onkeyup" visible="false">

                  <f:facet name="header">

                         <h:outputText value="Name" />

                  </f:facet>

                  <h:outputText value="#{edt.name}" />

           </rich:column>

           <rich:column id="date" width="100" headerClass="dataTableHeader" label="Date" sortable="true" comparator="#{extendedDT.dateComparator}" sortIconAscending="dataTableAscIcon" sortIconDescending="dataTableDescIcon">

                  <f:facet name="header">

                         <h:outputText value="Date" />

                  </f:facet>

                  <h:outputText value="#{edt.date}"><f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />

                  </h:outputText>

           </rich:column>

           <rich:column id="group" width="50" headerClass="dataTableHeader" label="Group" sortable="true" sortBy="#{edt.group}" sortIconAscending="dataTableAscIcon" sortIconDescending="dataTableDescIcon">

                  <f:facet name="header">

                         <h:outputText value="Group" />

                  </f:facet>

                  <h:outputText value="#{edt.group}" />

           </rich:column>

    </rich:extendedDataTable>

    ...

Figure 6.103. <rich:extendedDataTable> component with selected multiple lines

Information about sorting and filtering can be found here.

For external filtering <rich:extendedDataTable> component supports "filter" facet for <rich:column> component. In this facet you can define your own controls for filtering which will be positioned like built-in filter controls. Rest of the filter scenario is the same as described here.

In the example "selection" attribute contains object with selected rows.

## Note:

Attribute "height" is mandatory. The default value is "500px" .

Menu on the right side of the column header is used to perform action: sorting, grouping, hiding columns.

This is an example:

Figure 6.104. Column menu

After selecting a "Group by this column" option, you can see the data grouped. You can collapse and expand groups by clicking on a group header.

This is an example:

Figure 6.105. <rich:extendedDataTable> component with grouped data

The "label" attribute in <rich:column> sets the name of the column, which is used when dragging columns (in drag window) and in context menu, in "Columns" submenu.

Example:

    ...

    <rich:column id="name" label="#{msg['name']}"

    ...

Figure 6.106. <rich:extendedDataTable> component with Drag&Drop column 'Name'

In the component <rich:extendedDataTable> columns can hidden:

Figure 6.107. <rich:extendedDataTable> component with hidden column 'Id' and 'Group'

"tableState" attribute can be used to bind state of the table (column width, column position, visible, sequence, grouping...) to a backing-bean string property, for a later used. This state can be for example saved to a database, and it is different form standard JSF state saving mechanisms.

Example:

    ...

    <rich:extendedDataTable tableState="#{extendedDT.tableState}">

    ...

### 6.51.6. Facets

Table 6.185. Facets

Facet | Description
--- | ---
header | Redefines the header content
footer | Redefines the footer content
caption | Redefines the caption content

### 6.51.7. 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:extendedDataTable> components at once:

- Redefine the corresponding skin parameters

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

### 6.51.8. Skin Parameters Redefinition

Table 6.186. Skin parameters redefinition for a table

Skin parameters | CSS properties
--- | ---
tableBackgroundColor | background-color

Table 6.187. Skin parameters redefinition for a header

Skin parameters | CSS properties
--- | ---
headerBackgroundColor | background-color

Table 6.188. Skin parameters redefinition for a footer

Skin parameters | CSS properties
--- | ---
tableFooterBackgroundColor | background-color

Table 6.189. Skin parameters redefinition for a column header

Skin parameters | CSS properties
--- | ---
additionalBackgroundColor | background-color

Table 6.190. Skin parameters redefinition for a column footer

Skin parameters | CSS properties
--- | ---
tableSubfooterBackgroundColor | background-color

Table 6.191. Skin parameters redefinition for cells

Skin parameters | CSS properties
--- | ---
generalSizeFont | font-size
generalTextColor | color
generalFamilyFont | font-family

### 6.51.9. Definition of Custom Style Classes

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

Figure 6.108. <rich:extendedDataTable> class names

Table 6.192. Classes names that define a whole component appearance

Class name | Description
--- | ---
rich-extdt | Defines styles for all table
rich-extdt-caption | Defines styles for a "caption" facet element

Table 6.193. Classes names that define header and footer elements

Class name | Description
--- | ---
rich-extdt-header | Defines styles for a table header row
rich-extdt-header-continue | Defines styles for all header lines after the first
rich-extdt-subheader | Defines styles for a column header
rich-extdt-footer | Defines styles for a footer row
rich-extdt-footer-continue | Defines styles for all footer lines after the first
rich-extdt-subfooter | Defines styles for a column footer

Table 6.194. Classes names that define rows and cells of a table

Class name | Description
--- | ---
rich-extdt-headercell | Defines styles for a header cell
rich-extdt-subheadercell | Defines styles for a column header cell
rich-extdt-cell | Defines styles for a table cell
rich-extdt-row | Defines styles for a table row
rich-extdt-firstrow | Defines styles for a table start row
rich-extdt-footercell | Defines styles for a footer cell
rich-extdt-subfootercell | Defines styles for a column footer cell

An example of use the styles for component <rich:extendedDataTable> is similar to <rich:dataTable>

- Prev6.50. < rich:dropDownMenu >
- Top of page
- Front page
- Next6.52. < rich:menuGroup >