(Quick Reference)

sortableColumn

Purpose

Renders a sortable column to support sorting in tables.

Examples

<g:sortableColumn property="title" title="Title" />
<g:sortableColumn property="title" title="Title" style="width: 200px" />
<g:sortableColumn property="title" titleKey="book.title" />	 
<g:sortableColumn property="releaseDate" defaultOrder="desc" title="Release Date" />
<g:sortableColumn property="releaseDate" defaultOrder="desc" title="Release Date" titleKey="book.releaseDate" />

Description

Attribute title or titleKey is required. When both attributes are specified then titleKey takes precedence, resulting in the title caption to be resolved against the message source. In case when the message could not be resolved, the title will be used as title caption.

Attributes

  • property - name of the property relating to the field
  • defaultOrder (optional) - default order for the property; choose between asc (default if not provided) and desc
  • title (optional) - title caption for the column
  • titleKey (optional) - title key to use for the column, resolved against the message source
  • params (optional) - a map containing request parameters
  • action (optional) - the name of the action to use in the link, if not specified the list action will be linked

Source