# <netui-data:anchorColumn> Tag

This tag renders a column with an HTML hyperlink in each data cell.

## Syntax

<netui-data:anchorColumn
[action="string_action"]
[addRowId="boolean_addRowId"]
[alt="string_alt"]
[border="integer_border"]
[filterAction="string_filterAction"]
[filterable="boolean_filterable"]
[height="integer_height"]
[href="string_href"]
[name="string_name"]
[sortAction="string_sortAction"]
[sortable="boolean_sortable"]
[src="literal_or_expression_src"]
[styleClassPrefix="string_styleClassPrefix"]
title="string_title"
[width="integer_width"] />

## Description

This tag renders a column with an HTML hyperlink in each data cell. The anchor that is created is constructed from attributes on this tag and any nested <netui:parameter> or <netui:parameterMap> tags.

The hyperlink can be constructed in one of two ways: (1) using text provided in the `title` attribute or (2) 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 <netui:anchorColumn> has the ability to render a clickable image inside the hyperlink. 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 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 <netui:anchorColumn>. The New Page Flow Wizard (available at File-->New-->Page Flow) adds the `_grid.js` file to a project's /resources/grid directory, when you build a Page Flow over a database control. The JSP page should contain:
        <script language="javascript" src="/resources/grid/_grid.js"
            type="text/javascript"></script>

## Attributes

action | The action method invoked when the column header is clicked.
Required | Supports runtime expression evaluation | Data bindable
No | No | No
addRowId | Boolean. If set to true, the record's unique identifier, often a primary key, will be encoded into the record's link.
Required | Supports runtime expression evaluation | Data bindable
No | No | No
alt | The alternate text to display in the browser if the image can not be displayed.
Required | Supports runtime expression evaluation | Data bindable
No | No | No
border | Integer. The width of the border around the image.
Required | Supports runtime expression evaluation | Data bindable
No | No | No
filterAction | The action method that will handle the filter operation.
Required | Supports runtime expression evaluation | Data bindable
No | No | No
filterable | Boolean. Determines whether or not the column is filterable
Required | Supports runtime expression evaluation | Data bindable
No | No | No
height | Integer. The height of the image to be displayed in pixels.
Required | Supports runtime expression evaluation | Data bindable
No | No | No
href | The URL that is invoked when the column header is clicked.
Required | Supports runtime expression evaluation | Data bindable
No | Yes | No
name | Specifies the RowSet field to be rendered by the <netui-data:basicColumn> tag. The `name` attribute specifies which data in the RowSet should be extracted and rendered as a column. The `name` attribute should match one of the fields in the RowSet schema. For example, suppose you have the following RowSet schema (located in the RowSet control file), containing four data fields: `ITEMNUMBER`, `ITEMNAME`, `QUANTITYAVAILABLE`, and `PRICE`.
           <xsd:element name="ITEMNUMBER" type="xsd:int" ...>
           </xsd:element>
           <xsd:element name="ITEMNAME" type="xsd:string" ...>
           </xsd:element>
           <xsd:element name="QUANTITYAVAILABLE" type="xsd:int" ...>
           </xsd:element>
           <xsd:element name="PRICE" type="xsd:double" ...>
           </xsd:element>
The value of the `name` attribute should match one of the four values: `ITEMNUMBER`, `ITEMNAME`, `QUANTITYAVAILABLE`, or `PRICE`.
           <netui-data:basicColumn name="ITEMNUMBER" filterable="true" title="Itemnumber" sortable="true"/>
Required | Supports runtime expression evaluation | Data bindable
No | No | No
sortAction | The action method that will handle the sort operation.
Required | Supports runtime expression evaluation | Data bindable
No | No | No
sortable | Boolean. Determines whether or not the column is sortable.
Required | Supports runtime expression evaluation | Data bindable
No | No | No
src | The source of the image to display.
Required | Supports runtime expression evaluation | Data bindable
No | No | Read Only
styleClassPrefix | The style class prefix used to make the style class name in the header, data, and footer cells. The `styleClassPrefix` will be concatinated with a suffix to create style class names that are rendered inside of the <td> tags for each cell in this column. Assuming the value of this attribute is `foo`, the style class names rendered for each part of the column are shown in the table below.
Column Region | Style class
Header | foo-td-header
Data | foo-td-data
Footer | foo-td-footer
Required | Supports runtime expression evaluation | Data bindable
No | No | No
title | The text that will be rendered in the columns header.
Required | Supports runtime expression evaluation | Data bindable
Yes | No | No
width | Integer. The width of the image to be displayed in pixels.
Required | Supports runtime expression evaluation | Data bindable
No | No | No

## Sample

This sample shows <netui-data:anchorColumn> tags used in a <netui:grid> tag.

             <netui-data:grid dataSource="{pageFlow.allRows}" name="{pageFlow.gridName}">
                 <netui-data:gridStyle styleClassPrefix="gridStyle"/>
                 <netui-data:pager renderInHeader="true" action="pageAction" renderInFooter="true"/>
                 <netui-data:columns filterAction="begin" sortAction="begin">
                     <netui-data:anchorColumn action="detailsItems" addRowId="true" title="Details"/>
                     <netui-data:anchorColumn action="updateItems" addRowId="true" title="Edit"/>
                     <netui-data:basicColumn filterable="true" title="Itemnumber" sortable="true" name="itemnumber"/>
                     <netui-data:basicColumn filterable="true" title="Itemname" sortable="true" name="itemname"/>
                     <netui-data:basicColumn filterable="true" title="Quantityavailable" sortable="true" name="quantityavailable"/>
                     <netui-data:basicColumn filterable="true" title="Price" sortable="true" name="price"/>
                 </netui-data:columns>
             </netui-data:grid>

## Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/grid/grid.jsp

## Related Topics

<netui-data:grid> Tag Sample