# com.bea.wlw.netui.tags.databinding.grid.column
SortFilterColumn Class

public abstract class SortFilterColumn
extends `FormattableColumn`

The abstract base class of a grid column that is sortable and / or filterable. Depending on the type of the data set to which a grid tag is bound, the data set may be sortable and / or filterable. Columns of this type have attributes that determine these capabilities by using the attributes set on a `GridColumn``` tag and the parent `Columns``` tag.

If a particular `GridColumn``` is determined to be either sortable or filterable, the header of the column is rendered with HTML anchor tags (links) that will parameterize the URL to preform the sort or filter.

For a sortable column, the title of the column will be rendered as a link which, if clicked on, will set a sort in the URL parameters that preserves all previous sorts / filters and changes or sets the direction of a sort on this column.

For a filterable columm, a small filter icon will be rendered next to the column name that will display a UI which allows a filter, including the filter operation and filter value, to be set on the column.

In both the sort and filter case, the URL for a current page is changed in order to display the correct view on a data set on the next page.

Required resources:

The JavaScript file `_grid.js` must be included in any page with a `` if the Grid includes any SortFilterColumn that has filtering enabled.

Attribute Descriptions
Attribute | Required | Runtime Expression Evaluation | Data Bindable
--- | --- | --- | ---
filterable | No | No | No
A boolean that enables this column to be sortable. This attribute overrides the `Columns.setFilterable(boolean)``` attribute of the `Columns``` tag.
filterAction | No | No | No
The action that will be executed if this GridColumn is sorted. This attribute overrides the `Columns.setFilterAction(String)``` attribute of the `Columns``` tag.
name | No | No | No
When rendering in `Grid.ROWS``` state, this is the name of the data from the current data item that is rendered for this row.
sortable | No | No | No
A boolean that enables this column to be sortable. This attribute overrides the `Columns.setSortable(boolean)``` attribute of the `Columns``` tag.
sortAction | No | No | No
The action that will be executed if this GridColumn is sorted. This attribute overrides the `Columns.setSortAction(String)``` attribute of the `Columns``` tag.
title |  | No | No | Yes
The title that will be rendered in the header of this tag

Related Topics

``SortFilterService``

Hierarchy
  `Object`
  `TagSupport`
  `BodyTagSupport`
  `AbstractBaseTag`
  `StructuredBaseTag`
  `GridComponent`
  `GridColumn`
  `FormattableColumn`
  `SortFilterColumn`

All Implemented Interfaces
  `BodyTag`, `Formattable`, `IterationTag`, `Serializable`, `Tag`

Direct Known Subclasses
  `BasicColumn`, `ImageColumn`

## Field Summary

Fields from com.bea.wlw.netui.tags.databinding.base`.`StructuredBaseTag``
`EMPTY_STRING`

Fields from com.bea.wlw.netui.tags`.`AbstractBaseTag``
``ATTR_GENERAL`, `ATTR_GENERAL_EXPRESSION`, `ATTR_JAVASCRIPT`, `ATTR_STYLE`, `CLASS`, `ID`, `JAVASCRIPT_STATUS`, `NAME`, `NETUI_UNIQUE_CNT`, `ONCLICK`, `ONDBLCLICK`, `ONKEYDOWN`, `ONKEYPRESS`, `ONKEYUP`, `ONMOUSEDOWN`, `ONMOUSEMOVE`, `ONMOUSEOUT`, `ONMOUSEOVER`, `ONMOUSEUP`, `STYLE`, `TABINDEX``

Fields from javax.servlet.jsp.tagext`.`BodyTagSupport``
`bodyContent`

Fields from javax.servlet.jsp.tagext`.`TagSupport``
`id, pageContext`

Fields from interface javax.servlet.jsp.tagext`.`BodyTag``
`EVAL_BODY_BUFFERED, EVAL_BODY_TAG`

Fields from interface javax.servlet.jsp.tagext`.`IterationTag``
`EVAL_BODY_AGAIN`

Fields from interface javax.servlet.jsp.tagext`.`Tag``
`EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

## Constructor Summary

SortFilterColumn()

## Method Summary

`public boolean` | `canFilter`() Determine the absolute ability of a SortFilterColumn to be filtered.
`public boolean` | `canSort`() Determine the absolute ability of a SortFilterColumn to be filtered.
`public `String`` | `computeFilterAction`() Get the absolute filter action for a SortFilterColumn.
`public `String`` | `computeSortAction`() Get the absolute sort action for a SortFilterColumn.
`public `String`` | `getFilterAction`() Get the action that will be invoked if this column is filtered.
`public `String`` | `getName`() Get the name of the data that is rendered by this column.
`public `String`` | `getSortAction`() Get the action that will be invoked if this column is sorted.
`public `String`` | `getTitle`() Get the title rendered in the header cell of this column.
`protected `String`` | `getTitleText`()
`public boolean` | `isFilterable`() Get whether or not this column can be filtered.
`public boolean` | `isSortable`() Get whether or not this column can be sorted.
`protected void` | `localRelease`() Reset all of the fields of this tag.
`protected void` | `prepare`() Implementation of the StructuredBaseTag.prepare()`` method.
`public `String`` | `renderHeaderCell`() Render the header of a column that may be sortable or filterable.
`public void` | `setFilterable`(boolean filterable) Set whether or not this column can be filtered.
`public void` | `setFilterAction`(`String` filterAction) Set the action that will be invoked if this column is sorted.
`public void` | `setName`(`String` name) Set the name of the data that is referenced by this column.
`public void` | `setSortable`(boolean sortable) Set whether or not this column can be sorted.
`public void` | `setSortAction`(`String` sortAction) Set the action that will be invoked if this column is sorted.
`public void` | `setTitle`(`String` title) Set the title rendered in the header cell of this column.
`protected void` | `verifyAttributes`() Ensure that the attributes set on the tag are valid.

Methods from `com.bea.wlw.netui.tags.databinding.grid.column.`FormattableColumn``
``addFormatter`, `format`, `renderStartTag``

Methods from `com.bea.wlw.netui.tags.databinding.grid.column.`GridColumn``
``getColumns`, `getStyleClassPrefix`, `getValidContainerType`, `localRelease`, `renderCloseCellTag`, `renderDataCell`, `renderDataCellTag`, `renderEndTag`, `renderFooterCell`, `renderFooterCellTag`, `renderHeaderCellTag`, `renderOpenCellTag`, `renderStartTag`, `setStyleClassPrefix``

Methods from `com.bea.wlw.netui.tags.databinding.grid.`GridComponent``
``getCurrentRenderState`, `getGrid`, `getGridContext`, `getValidContainerType`, `localRelease`, `prepare``

Methods from `com.bea.wlw.netui.tags.databinding.base.`StructuredBaseTag``
`addContent, doEndTag, doStartTag, getContent, getCurrentRenderState, getValidContainerType, localRelease, prepare, renderEndTag, renderStartTag, verifyStructure`

Methods from `com.bea.wlw.netui.tags.`AbstractBaseTag``
``addTagIdMapping`, `evaluateAttributeToString`, `filter`, `filter`, `getJavaScriptUtils`, `getNearestForm`, `getScriptReporter`, `getTagName`, `getUserLocale`, `localRelease`, `registerTagError`, `release`, `renderAttribute`, `rewriteName`, `write``

Methods from `javax.servlet.jsp.tagext.`BodyTagSupport``
`doAfterBody, doEndTag, doInitBody, doStartTag, getBodyContent, getPreviousOut, release, setBodyContent`

Methods from `javax.servlet.jsp.tagext.`TagSupport``
`doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `javax.servlet.jsp.tagext.`BodyTag``
`doInitBody, setBodyContent`

Methods from interface `com.bea.wlw.netui.tags.html.`Formattable``
``addFormatter``

Methods from interface `javax.servlet.jsp.tagext.`IterationTag``
`doAfterBody`

Methods from interface `javax.servlet.jsp.tagext.`Tag``
`doEndTag, doStartTag, getParent, release, setPageContext, setParent`

## Constructor Detail

### SortFilterColumn

    public SortFilterColumn()

## Method Detail

### canFilter() Method

    public boolean canFilter()

Determine the absolute ability of a SortFilterColumn to be filtered. The capability of a column to be filterable is determined as a combination of the sortable attributes on this tag as well as the sortable attribute on the `Columns``` tag. The rules for determining whether a column is filterable are:

- If the filterable attribute is unset, the Columns tag's filterable atrribute is used.
- If the filterable attribute is used, the filterable atrribute is used.

### canSort() Method

    public boolean canSort()

Determine the absolute ability of a SortFilterColumn to be filtered. The capability of a column to be sortable is determined as a combination of the sortable attributes on this tag as well as the sortable attribute on the `Columns``` tag. The rules for determining whether a column is sortable are:

- If the sortable attribute is unset, the Columns tag's sortable atrribute is used.
- If the sortable attribute is used, the sortable atrribute is used.

### computeFilterAction() Method

    public String computeFilterAction()

Get the absolute filter action for a SortFilterColumn. This filter action is determined by combining the filter action on this tag as well as the filter action on the `Columns``` tag. The rules for determining the filter action are:

- If the filter action on this column is set, this attribute is used.
- Otherwise, the Columns tag's filter action attribute is used.

### computeSortAction() Method

    public String computeSortAction()

Get the absolute sort action for a SortFilterColumn. This sort action is determined by combining the sort action on this tag as well as the sort action on the `Columns``` tag. The rules for determining the sort action are:

- If the sort action on this column is set, this attribute is used.
- Otherwise, the Columns tag's sort action attribute is used.

### getFilterAction() Method

    public String getFilterAction()

Get the action that will be invoked if this column is filtered.

#### Returns

the action that will be called to filter the column

### getName() Method

    public String getName()

Get the name of the data that is rendered by this column.

#### Returns

the name of the data to render

### getSortAction() Method

    public String getSortAction()

Get the action that will be invoked if this column is sorted.

#### Returns

the action that will be called to sort the column

### getTitle() Method

    public String getTitle()

Get the title rendered in the header cell of this column.

#### Returns

the title of the colum

### getTitleText() Method

    protected String getTitleText()

### isFilterable() Method

    public boolean isFilterable()

Get whether or not this column can be filtered.

#### Returns

`true` if this column is filterable; `false` otherwise.

### isSortable() Method

    public boolean isSortable()

Get whether or not this column can be sorted.

#### Returns

`true` if this coolumn is sortable; `false` otherwise.

### localRelease() Method

    protected void localRelease()

Reset all of the fields of this tag.

Overrides
  `FormattableColumn.localRelease()`

### prepare() Method

    protected void prepare()

Description copied from `GridColumn.prepare()`
Implementation of the StructuredBaseTag.prepare()`` method. This method finds the parent `Columns``` tag and references it locally so that subclasses can access the Columns tag easily.

Overrides
  `GridColumn.prepare()`

### renderHeaderCell() Method

    public String renderHeaderCell()
         throws JspException

Render the header of a column that may be sortable or filterable. Sorting and filtering on a Grid is performed through the use of a URL syntax that is interpreted into statements that can sort or filter the grid's dataset. The links to sort or filter a grid column are rendered in the header of the column.
If a column is sortable, the title of the column will be rendered as a link that, when pressed, will sort the column in an order opposite the order of the current sort.
If a column is filterable, an image anchor will be rendered as a link that, when pressed, will filter the column using the operation and values that are provided in the URL.

Overrides
  `GridColumn.renderHeaderCell()`

#### Returns

the String content of this header cell

#### Exceptions

``JspException``
  if an error occurs that can not be shown in the page

### setFilterable(boolean) Method

    public void setFilterable(boolean filterable)

Set whether or not this column can be filtered.

#### Parameters

filterable
  a boolean that sets this capability. If `true` this column may be filterable; otherwise it is not.

### setFilterAction(String) Method

    public void setFilterAction(String filterAction)

Set the action that will be invoked if this column is sorted. The use of this attribute requires the presence of a `PageFlowController``` in the JSP's directory.

#### Parameters

filterAction
  the action that will be called to filter the column

### setName(String) Method

    public void setName(String name)

Set the name of the data that is referenced by this column. Because data is extracted from the "current" data item by name, the name attribute is used to specify which data should be extraced for a given column. This attribute is usually used when rendering the value for a cell that is rendered in the Grid's `Grid.ROWS``` render state.

#### Parameters

name
  the name of the data to extract from the current data item.

### setSortable(boolean) Method

    public void setSortable(boolean sortable)

Set whether or not this column can be sorted.

#### Parameters

sortable
  a boolean that sets this capability. If `true` this column may be filterable; otherwise it is not.

### setSortAction(String) Method

    public void setSortAction(String sortAction)

Set the action that will be invoked if this column is sorted. The use of this attribute requires the presence of a `PageFlowController``` in the JSP's directory.

#### Parameters

sortAction
  the action that will be called to sort the column

### setTitle(String) Method

    public void setTitle(String title)

Set the title rendered in the header cell of this column.

#### Parameters

title
  the title of the column

### verifyAttributes() Method

    protected void verifyAttributes()
         throws JspException

Ensure that the attributes set on the tag are valid. The requirements are:

- If the column is determined to be filterable using the `SortFilterColumn.canFilter()``` method, the `SortFilterColumn.computeFilterAction()``` must return an action.
- If the column is determined to be sortable using the `SortFilterColumn.canSort()``` method, the `SortFilterColumn.computeSortAction()``` must return an action.

Overrides
  StructuredBaseTag.verifyAttributes()

#### Exceptions

``JspException``
  if an error occurs that can not be reported in the page