Apache Struts 2 Plugin Registry > Home > Table Tags > SortableHeader Tag
Added by Tom Schneider, last edited by Tom Schneider on Feb 24, 2007  (view change)

Description

The SortableHeader tag renders table headers that allow a user to see the current sort order and to resort the data.

Examples

<!-- A simple example that uses sortable headers. -->
...
<thead>
  <tr>
    <th><tt:sortableHeader action="Table" name="sortColumnKey"
      title="Column 1" sortKey="col1" sortOrder="sortOrder"
      sortable="true" /></th>
    <th><tt:sortableHeader action="Table" name="sortColumnKey"
      title="Column 2" sortKey="col2" sortOrder="sortOrder"
      sortable="true" /></th>
    <th><tt:sortableHeader action="Table" name="sortColumnKey"
      title="Column 3" sortKey="col3" sortOrder="sortOrder"
      sortable="true" /></th>
    <th><tt:sortableHeader action="Table" name="sortColumnKey"
      title="Column 4" sortKey="col4" sortOrder="sortOrder"
      sortable="true" /></th>
    <th><tt:sortableHeader action="Table" name="sortColumnKey"
      title="Column 5" sortKey="col5" sortOrder="sortOrder"
      sortable="true" /></th>
  </tr>
</thead>
...

SortableHeader Tag Attributes

Name Required Type Description
sortKey false String the column key used to determine if the currently selected column
sortOrder false String the action property name of the sort order
sortable true Boolean Whether or not the user should be allowed to sort the column
action false String the name of the action for the link
namespace false String the namespace of the action for the link
method false String the action method for the link
url false String the full url for the link