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

public class AnchorColumn
extends `ImageColumn`
implements `URLParams`

A column that renders an HTML anchor into each data cell in the column. The anchor that is created is constructed from attributes on this tag and any nested `Parameter``` or `ParameterMap``` tags; this GridColumn implements the `URLParams``` interface. The anchor can be constructed in one of two ways -- using text provided in the title attribute or using data from the current item in the data set. If using the title attribute, the column is not filterable or sortable as there is no data from the data set to filter or sort. If using data from the current item, the column can be filtered and sorted.

The AnchorColumn has the ability to render an image inside the anchor, resulting in the image being clickable. This can be accomplished by setting the `src` attribute and other attributes that are available on the `ImageColumn``` tag. An image will be rendered if the `src` attribute is set and the `name` attribute is null. Otherwise, the data in the current data item that that matches the `name` attribute will be rendered. If rendering an image using the `src` attribute, the column can be sorted and filtered on the name of the image.

In constructing an anchor from the attributes on the tag, exactly one of the href and action attributes must be specified. Providing both or neither will result in an error being reported.

Required resources:

The JavaScript file `_grid.js` must be included in any JSP page with a grid that uses a filter-enabled AnchorColumn. The Page Flow Wizard adds the `_grid.js` file to a project's /resources/grid directory, when you build a page flow over a database control. The JSP should contain: <script language="javascript" src="/resources/grid/_grid.js" type="text/javascript"></script>

Attribute Descriptions
Attribute | Required | Runtime Expression Evaluation | Data Bindable
--- | --- | --- | ---
action | No | No | No
The action that should be part of the HTML anchor that is rendered in this column.
addRowId | No | Yes | No
A boolean that denotes that the unique identifier for this row, if one is available, will be rendered onto the generated HTML anchor.
alt | No | Yes | No
The alternate text displayed in the browser if the image cannot be displayed.
border | No | Yes | No
The number of pixels to display in a border around this image. The default border is zero.
filterable | No | Yes | No
A boolean specifying whether the anchors can be filtered.
filterAction | No | Yes | No
The name of the action that will perform the filter operation.
href | No | Yes | No
The web addressable resource that will be part of the HTML anchor that is rendered in this column.
name | No | Yes | Yes
If specified, the value of the data is extracted from the Grid's current data item. Otherwise, the `title` attribute is used for the cell's content.
sortable | No | Yes | No
A boolean specifying whether the anchor column's contents can be sorted.
sortAction | No | Yes | No
The name of the action that will perform the sort operation.
title | No | No | No
The text that will be rendered in the header for this column.

Related Topics

<netui-data:grid> Tag Sample

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

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

## 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

AnchorColumn()

## Method Summary

`public void` | `addParameter`(`String` name, `Object` value) This method allows the key / value pairs that will be written onto the URL to be added to the anchor that is rendered for each cell in the column that is rendered for an item in the dataset.
`public `String`` | `getAction`() Get the action that is rendered in the anchor of this column.
`public boolean` | `getAddRowId`() Get the boolean for whether this tag will encode a record's unique identifier into the URL.
`public `String`` | `getHref`() Get the href that is rendered in the anchor of this column.
`public `String`` | `getTagName`() Get the name of this tag.
`protected void` | `localRelease`() Reset all of the fields of this tag.
`protected void` | `prepare`() Perform initialization for this tag.
`public `String`` | `renderDataCell`() Render the contents of this `AnchorColumn``` for the current data item from the containing Grid tag.
`public `String`` | `renderFooterCell`() Render the footer.
`protected int` | `renderStartTag`(int gridState) This tag only evaluates its body when the grid is rendering its `ROWS`.
`public void` | `setAction`(`String` action) Set the action that is rendered in the anchor of this column.
`public void` | `setAddRowId`(boolean addRowId) Set a boolean that, if `true`, will encode the record's unique identifier, often the primary key, onto each anchor's URL link.
`public void` | `setHref`(`String` href) Set the href that is rendered in the anchor of this column.
`protected void` | `verifyAttributes`() Verify the attributes on this tag.

Methods from `com.bea.wlw.netui.tags.databinding.grid.column.`ImageColumn``
``getAlt`, `getBorder`, `getHeight`, `getSrc`, `getWidth`, `renderImage`, `setAlt`, `setBorder`, `setHeight`, `setSrc`, `setWidth`,`

Methods from `com.bea.wlw.netui.tags.databinding.grid.column.`SortFilterColumn``
``canFilter`, `canSort`, `computeFilterAction`, `computeSortAction`, `getFilterAction`, `getName`, `getSortAction`, `getTitle`, `getTitleText`, `isFilterable`, `isSortable`, `localRelease`, `prepare`, `renderHeaderCell`, `setFilterable`, `setFilterAction`, `setName`, `setSortable`, `setSortAction`, `setTitle`, `verifyAttributes``

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

Methods from `com.bea.wlw.netui.tags.databinding.grid.column.`GridColumn``
``getColumns`, `getStyleClassPrefix`, `getValidContainerType`, `localRelease`, `prepare`, `renderCloseCellTag`, `renderDataCell`, `renderDataCellTag`, `renderEndTag`, `renderFooterCell`, `renderFooterCellTag`, `renderHeaderCell`, `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, verifyAttributes, 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`

Methods from interface `com.bea.wlw.netui.tags.html.`URLParams``
``addParameter``

## Constructor Detail

### AnchorColumn

    public AnchorColumn()

## Method Detail

### addParameter(String, Object) Method

    public void addParameter(String name,
                             Object value)

This method allows the key / value pairs that will be written onto the URL to be added to the anchor that is rendered for each cell in the column that is rendered for an item in the dataset.

Related Topics

``URLParams``
``Parameter``
``ParameterMap``

### getAction() Method

    public String getAction()

Get the action that is rendered in the anchor of this column.

#### Returns

the name of the action or `null`

### getAddRowId() Method

    public boolean getAddRowId()

Get the boolean for whether this tag will encode a record's unique identifier into the URL.

#### Returns

`true` if the unique identifier will be encoded; `false` otherwise.

### getHref() Method

    public String getHref()

Get the href that is rendered in the anchor of this column.

#### Returns

the href that was specified or `null`

### getTagName() Method

    public String getTagName()

Get the name of this tag. This is used to identify the type of this tag for reporting tag errors.

Overrides
  `ImageColumn.getTagName()`

#### Returns

a constant String representing the name of this tag.

### localRelease() Method

    protected void localRelease()

Reset all of the fields of this tag.

Overrides
  `ImageColumn.localRelease()`

### prepare() Method

    protected void prepare()

Perform initialization for this tag.

Overrides
  `ImageColumn.prepare()`

### renderDataCell() Method

    public String renderDataCell()
         throws JspException

Render the contents of this `AnchorColumn``` for the current data item from the containing Grid tag. An AnchorColumn uses either the href or the action attribute to render an HTML anchor into each data cell in the column. If a name attribute is specified, the value of the data is extracted from the Grid's current data item. Otherwise, the title attribute is used for the cell's content.

Overrides
  `ImageColumn.renderDataCell()`

#### Exceptions

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

### renderFooterCell() Method

    public String renderFooterCell()

Render the footer. This footer contains no text.

Overrides
  `ImageColumn.renderFooterCell()`

#### Returns

the emtpy string

### renderStartTag(int) Method

    protected int renderStartTag(int gridState)

This tag only evaluates its body when the grid is rendering its `ROWS`.

Overrides
  `ImageColumn.renderStartTag(int)`

#### Parameters

gridState
  the state of this column's Grid tag parent

### setAction(String) Method

    public void setAction(String action)

Set the action that is rendered in the anchor of this column. The use of the action attribute on an AnchorColumn requires a `PageFlowController``` as an action must be defined in order to render the href attrubite on the resulting anchor.

#### Parameters

action
  the name of the action from a PageFlow

Related Topics

``PageFlowController``

### setAddRowId(boolean) Method

    public void setAddRowId(boolean addRowId)

Set a boolean that, if `true`, will encode the record's unique identifier, often the primary key, onto each anchor's URL link.

#### Parameters

addRowId
  a boolean that will encode the unique identifier if `true`

### setHref(String) Method

    public void setHref(String href)

Set the href that is rendered in the anchor of this column. Only one of the href and action attributes may be set on this tag.

#### Parameters

href
  the href to render in the HTML anchor tag.

### verifyAttributes() Method

    protected void verifyAttributes()
         throws JspException

Verify the attributes on this tag. Exactly one of the attributes href and action must be specified.

Overrides
  `ImageColumn.verifyAttributes()`

#### Exceptions

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