Brian Leathem

4 minute read

RichFaces

The upcoming 4.3 release of RichFaces will offer the RichFaces community a number of improvements to the extendedDataTable. These new features include:

  • Built-in sorting and filtering
  • External table state saving
  • A number of bug-fixes

Built-in sorting and filtering

The RichFaces 4 extendedDataTable (EDT) has always had the ability to sort and filter columns, but required the developer to define the sort and filter controls themselves, then manually invoke the required operations on the back-end. While not difficult to do, a lot of boiler-plate code was required for what is in fact a common operation. With RichFaces 4.3 we’ve resolved RF-8125 that tracked a long standing request to port the built-in search capabilities form the RichFaces 3 EDT to RichFaces 4.

div(alert alert-info). Built-in sorting/filtering is currently only available in the extendedDataTable component. We will add support to the dataTable component in a subsequent release.

Built-in Sorting

Implementing sortable columns in the EDT is now as simple as adding the sortBy attribute to your EDT column, and the sort controls will automatically be generated and linked to the internal sorting mechanism. To influence how the sorting is performed, add the comparator attribute to your column, and the comparator defined there will be used for the sort.

Refer to the RichFaces 4 Component Reference for additional details on using the built-in and external sort controls.

div(alert alert-warning). If you require additional flexibility, and prefer to implement your own sort controls, set the sortType=custom attribute, and the built-in sort controls will not be rendered. Built-in sort controls can be disabled altogether by setting the web.xml context param org.richfaces.builtin.sort.enabled to false.

Built-in Filtering

Similarly, taking advantage of the built-in filter controls is also straightforward. Define the filterValue attribute on the column to be filtered, then define either a filterExpression or filter attribute to implement the filter logic. When the attributes are present an input element will be displayed in the column header. Simple value conversions are performed implicitly in the EL of the filterExpression or explicitly in the filter implementation.

Refer to the RichFaces 4 Component Reference for additional details on using the built-in and external filter controls.

div(alert alert-warning). Further control over the filter controls can be achieved by setting the filterType=custom attribute, and implementing your own filter controls in the back-end. Built-in filter controls can be disabled altogether by setting the web.xml context param org.richfaces.builtin.filter.enabled to false.

ExtendedDataTable State Saving

The EDT has had another RichFaces 3 feature ported forward: table state saving. With the resolution of RF-10442, application developers can add the tableState attribute to their EDT components, providing a value-binding to a bean String property that can be used to store the state of the column width, sequence, sorting, and filtering of the EDT. The table state is stored in a JSON string format, and is easily stored in a data base for later retrieval.

Bug fixes

In addition to the above feature additions, the EDT has seen a number of bug fixes in the 4.3 release. These fixes include:

RF-10154

UIDataAdaptor vs. UIData visitTee small difference

RF-10799

EDT - attribute @clientRows missing in taglib

RF-11382

Datatable and ExtendedDatatable evaluate value attribute even if rendered=false

RF-11776

rich:extendedDataTable columnsOrder attribute is not working

RF-12236

showcase - rich:extendedDataTable - re-sizing columns breaks horizontal scrolling

RF-12450

Collapsible subtable toggler not rendered

RF-12611

rich:dataTable doesn’t call restoreState() on a row-level composite component

RF-12639

rich:extendedDataTable inside rich:tab: The columns which are not frozen are not rendered after switching the tab for the first time in IE 8.

RF-12659

ExtendedDataTable layout breaks when table element width set to 100%

RF-12672

Collapsible sub table: noData facet doesn’t work inside switchable panels

RF-12684

The last page shows rows from the page before if rich:collapsibleSubTable is included in rich:dataTable with rich:dataScroller.

RF-12691

extendedDataTable: Header facet render problem in RichFaces 4

The 4.3 release

RichFaces 4.3.0.CR1 is currently available, having undergone our extensive QA process, and a 4.3.0.CR2 release will be available shortly. Please take the time to take the extendedDataTable for a spin with this release, and give us your feedback for the new features and bug fixes via the RichFaces forum or issue tracker.