API: datatable YAHOO.widget.Column (YUI Library)

# Yahoo! UI Library

### DataTable Widget 2.9.0

Yahoo! UI Library > datatable > YAHOO.widget.Column
Search:
Filters Show Private Show Protected Show Deprecated

## Class YAHOO.widget.Column

The Column class defines and manages attributes of DataTable Columns

### Constructor

YAHOO.widget.Column `( oConfigs )`

Parameters:
  `oConfigs <Object>` Object literal of definitions.

### Properties

#### _dd - `private YAHOO.util.DragDrop`

For unreg() purposes, a reference to the Column's DragDrop instance.

#### _ddResizer - `private YAHOO.util.DragDrop`

For unreg() purposes, a reference to the Column resizer's DragDrop instance.

#### _elResizer - `private HTMLElement`

The DOM reference to the associated resizerelement (if any).

#### _elTh - `private HTMLElement`

The DOM reference to the associated TH element.

#### _elThLabel - `private HTMLElement`

The DOM reference to the associated TH element's label SPAN element.

#### _elThLiner - `private HTMLElement`

The DOM reference to the associated TH element's liner DIV element.

#### _nColspan - `private Number`

Number of table cells the Column spans.

#### _nKeyIndex - `private Number`

Reference to Column's current position index within its ColumnSet's keys array, if applicable. This property only applies to non-nested and bottom- level child Columns.

#### _nRowspan - `private Number`

Number of table rows the Column spans.

#### _nTreeIndex - `private Number`

Reference to Column's current position index within its ColumnSet's tree array, if applicable. This property only applies to non-nested and top- level parent Columns.

#### _nWidth - `private Number`

Internal width tracker.

#### _oParent - `private YAHOO.widget.Column`

Column's parent Column instance, or null.

#### _sId - `private String`

Unique String identifier assigned at instantiation.

#### abbr - `String`

Column head cell ABBR for accessibility.

#### children - `Object[]`

Array of object literals that define children (nested headers) of a Column.

#### className - `String || String[]`

Custom CSS class or array of classes to be applied to every cell in the Column.

#### Column._nCount - `private static Number`

Internal class variable to index multiple Column instances.

#### currencyOptions - `Object`

Config passed to YAHOO.util.Number.format() by the 'currency' Column formatter.
Default Value: null

#### dateOptions - `Object`

Config passed to YAHOO.util.Date.format() by the 'date' Column formatter.
Default Value: null

#### dropdownOptions - `HTML[] | Object[]`

Array of dropdown values for formatter:"dropdown" cases. Can either be a simple array (e.g., ["Alabama","Alaska","Arizona","Arkansas"]) or a an array of objects (e.g., [{label:"Alabama", value:"AL"}, {label:"Alaska", value:"AK"}, {label:"Arizona", value:"AZ"}, {label:"Arkansas", value:"AR"}]). String values are treated as markup and inserted into the DOM as innerHTML.

#### editor - `YAHOO.widget.CellEditor`

A CellEditor instance, otherwise Column is not editable.

#### field - `String`

Associated database field, or null.

#### formatter - `String || HTMLFunction`

Cell formatter function, or a shortcut pointer to a function in the DataTable.Formatter object. The function, called from the DataTable's formatCell method, renders markup into the cell liner element and accepts the following arguments:

elLiner
  The element to write innerHTML to.
oRecord
  The associated Record for the row.
oColumn
  The Column instance for the cell.
oData
  The data value for the cell.

#### hidden - `Boolean`

True if Column is in hidden state.
Default Value: false

#### key - `String|HTML`

Unique name, required. If "label" property is not provided, the "key" value will be treated as markup and inserted into the DOM as innerHTML.

#### label - `HTML`

Value displayed as Column header in the TH element. String value is treated as markup and inserted into the DOM as innerHTML.

#### maxAutoWidth - `Number`

When a width is not defined for a Column, maxAutoWidth defines an upper limit that the Column should be auto-sized to. If resizeable is enabled, users may still resize to a greater width. Most useful for Columns intended to hold long unbroken, unwrapped Strings, such as URLs, to prevent very wide Columns from disrupting visual readability by inducing truncation.
Default Value: null

#### minWidth - `Number`

Minimum Column width (in pixels).
Default Value: null

#### resizeable - `Boolean`

True if Column is resizeable, false otherwise. The Drag & Drop Utility is required to enable this feature. Only bottom-level and non-nested Columns are resizeble.
Default Value: false

#### selected - `Boolean`

True if Column is in selected state.
Default Value: false

#### sortable - `Boolean`

True if Column is sortable, false otherwise.
Default Value: false

#### sortOptions.defaultDir - `String`

Default sort direction for Column: YAHOO.widget.DataTable.CLASS_ASC or YAHOO.widget.DataTable.CLASS_DESC.
Default Value: null

#### sortOptions.defaultOrder - `object`

Deprecated: Use sortOptions.defaultDir.

#### sortOptions.field - `String`

Custom field to sort on.
Default Value: null

#### sortOptions.sortFunction - `Function`

Custom sort handler. Signature: sortFunction(a, b, desc, field) where field is the sortOptions.field value
Default Value: null

#### width - `Number`

Column width (in pixels).

### Methods

#### getColEl

`void getColEl ( )`
Deprecated Use getThEl

#### getColspan

`Number getColspan ( )`
Public accessor returns Column's calculated COLSPAN value.

Returns: `Number`
  Column's COLSPAN value.

#### getDefinition

`Object getDefinition ( )`
Returns object literal definition.

Returns: `Object`
  Object literal definition.

#### getField

`String getField ( )`
Returns field.

Returns: `String`
  Column field.

#### getId

`String getId ( )`
Returns unique ID string.

Returns: `String`
  Unique ID string.

#### getKey

`String getKey ( )`
Returns unique Column key.

Returns: `String`
  Column key.

#### getKeyIndex

`Number getKeyIndex ( )`
Public accessor returns Column's current position index within its ColumnSet's keys array, if applicable. Only non-nested and bottom-level child Columns will return a value.

Returns: `Number`
  Position index, or null.

#### getParent

`YAHOO.widget.Column getParent ( )`
Public accessor returns Column's parent instance if any, or null otherwise.

Returns: `YAHOO.widget.Column`
  Column's parent instance.

#### getResizerEl

`HTMLElement getResizerEl ( )`
Returns DOM reference to the resizer element, or null.

Returns: `HTMLElement`
  DIV element.

#### getRowspan

`Number getRowspan ( )`
Public accessor returns Column's calculated ROWSPAN value.

Returns: `Number`
  Column's ROWSPAN value.

#### getSanitizedKey

`String getSanitizedKey ( )`
Returns Column key which has been sanitized for DOM (class and ID) usage starts with letter, contains only letters, numbers, hyphen, or period.

Returns: `String`
  Sanitized Column key.

#### getThEl

`HTMLElement getThEl ( )`
Returns DOM reference to the key TH element.

Returns: `HTMLElement`
  TH element.

#### getThLInerEl

`HTMLElement getThLInerEl ( )`
Returns DOM reference to the TH's liner DIV element. Introduced since resizeable Columns may have an extra resizer liner, making the DIV liner not reliably the TH element's first child.

Returns: `HTMLElement`
  TH element.

#### getTreeIndex

`Number getTreeIndex ( )`
Public accessor returns Column's current position index within its ColumnSet's tree array, if applicable. Only non-nested and top-level parent Columns will return a value;

Returns: `Number`
  Position index, or null.

#### toString

`String toString ( )`
Column instance name, for logging.

Returns: `String`
  Column's unique name.

Copyright © 2011 Yahoo! Inc. All rights reserved.