Yahoo! UI Library

DataTable Widget  2.2.0

Yahoo! UI Library > datatable > Column

Class Column

The Column class defines and manages attributes of DataTable Columns

Constructor

Column ( oConfigs )
Parameters:
oConfigs <Object> Object literal of configuration values.

Properties

_children - private YAHOO.widget.Column[]

Array of Column's chilren, or null.

_colspan - private Number

Number of table cells the Column spans.

_id - private String

Unique ID, also assigned as DOM ID.

_index - private Number

Reference to Column's index within its ColumnSet's key array, or null if not applicable.

_minWidth - private Number

Minimum width the Column can support (in pixels). Value is populated only if table is fixedwidth, null otherwise.

_nCount - static Number

Internal instance counter.
Default Value: 0

_parent - private YAHOO.widget.Column

Column's parent, or null.

_rowspan - private Number

Number of table rows the Column spans.

_width - private Number

Current offsetWidth of the Column (in pixels).

abbr - String

Column head cell ABBR for accessibility.

children - Object[]

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

className - String

Custom CSS class to be applied to every cell in the Column.

editor - String

Defines the type of editor for Column, otherwise Column is not editable.

formatter - HTMLFunction

Defines a custom format function for Column, otherwise default is used, according to Column type.

key - String

Associated database field, or null.

parser - HTMLFunction

Defines a custom parse function for Column, otherwise default is used, according to Column type.

resizeable - Boolean

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

sortable - Boolean

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

sortOptions.ascFunction - Function

Custom sort handler to arrange Column in ascending order.
Default Value: null

sortOptions.descFunction - Function

Custom sort handler to arrange Column in descending order.
Default Value: null

text - String

Text or HTML for display in Column's assocated TH element.

type - String

Data types: "string", "number", "date", "currency", "checkbox", "select", "email", "link".
Default Value: "string"

width - String

Column width.

Methods

format

HTML format ( elCell , oRecord )
Outputs markup into the given TD based on given Record.
Parameters:
elCell <HTMLElement> TD to format for display.
oRecord <YAHOO.widget.Record> Record that holds data for the row.
Returns: HTML
Markup.

formatCheckbox

static void formatCheckbox ( elCell , oRecord , oColumn , oData )
Formats cells in Columns of type "checkbox".
Parameters:
elCell <HTMLElement> Table cell element.
oRecord <YAHOO.widget.Record> Record instance.
oColumn <YAHOO.widget.Column> Column instance.
oData <Object> Data value for the cell, or null
Returns: void

formatCurrency

static void formatCurrency ( elCell , oRecord , oColumn , oData )
Formats cells in Columns of type "currency". Can be overridden for custom formatting.
Parameters:
elCell <HTMLElement> Table cell element.
oRecord <YAHOO.widget.Record> Record instance.
oColumn <YAHOO.widget.Column> Column instance.
oData <Object> Data value for the cell, or null
Returns: void

formatDate

static void formatDate ( elCell , oRecord , oColumn , oData )
Formats cells in Columns of type "date".
Parameters:
elCell <HTMLElement> Table cell element.
oRecord <YAHOO.widget.Record> Record instance.
oColumn <YAHOO.widget.Column> Column instance.
oData <Object> Data value for the cell, or null
Returns: void

formatEmail

static void formatEmail ( elCell , oRecord , oColumn , oData )
Formats cells in Columns of type "email".
Parameters:
elCell <HTMLElement> Table cell element.
oRecord <YAHOO.widget.Record> Record instance.
oColumn <YAHOO.widget.Column> Column instance.
oData <Object> Data value for the cell, or null
Returns: void

formatLink

static void formatLink ( elCell , oRecord , oColumn , oData )
Formats cells in Columns of type "link".
Parameters:
elCell <HTMLElement> Table cell element.
oRecord <YAHOO.widget.Record> Record instance.
oColumn <YAHOO.widget.Column> Column instance.
oData <Object> Data value for the cell, or null
Returns: void

formatNumber

static void formatNumber ( elCell , oRecord , oColumn , oData )
Formats cells in Columns of type "number".
Parameters:
elCell <HTMLElement> Table cell element.
oRecord <YAHOO.widget.Record> Record instance.
oColumn <YAHOO.widget.Column> Column instance.
oData <Object> Data value for the cell, or null
Returns: void

formatSelect

static void formatSelect ( elCell , oRecord , oColumn , oData )
Formats cells in Columns of type "select".
Parameters:
elCell <HTMLElement> Table cell element.
oRecord <YAHOO.widget.Record> Record instance.
oColumn <YAHOO.widget.Column> Column instance.
oData <Object> Data value for the cell, or null
Returns: void

getColSpan

Number getColSpan ( )
Public accessor returns Column's colspan number.
Returns: Number
Column's colspan number.

getId

String getId ( )
Public accessor returns Column's ID string.
Returns: String
Column's ID string.

getRowSpan

Number getRowSpan ( )
Public accessor returns Column's rowspan number.
Returns: Number
Column's rowspan number.

parse

Object parse ( sMarkup )
Takes innerHTML from TD and parses out data for storage in RecordSet.
Parameters:
sMarkup <String> The TD's innerHTML value.
Returns: Object
Data.

parseCheckbox

bChecked parseCheckbox ( sMarkup )
Default parse function for Columns of type "checkbox" takes markup and extracts data. Can be overridden for custom parsing.
Parameters:
sMarkup <object>
Returns: bChecked
True if checkbox is checked.

parseCurrency

nAmount parseCurrency ( sMarkup )
Default parse function for Columns of type "currency" takes markup and extracts data. Can be overridden for custom parsing.
Parameters:
sMarkup <object>
Returns: nAmount
Floating point amount.

parseDate

oDate parseDate ( sMarkup )
Default parse function for Columns of type "date" takes markup and extracts data. Can be overridden for custom parsing.
Parameters:
sMarkup <object>
Returns: oDate
Date instance.

parseNumber

nNumber parseNumber ( sMarkup )
Default parse function for Columns of type "number" takes markup and extracts data. Can be overridden for custom parsing.
Parameters:
sMarkup <object>
Returns: nNumber
Number.

parseSelect

sValue parseSelect ( sMarkup )
Default parse function for Columns of type "select" takes markup and extracts data. Can be overridden for custom parsing.
Parameters:
sMarkup <object>
Returns: sValue
Value of selected option.

showEditor

void showEditor ( elCell , oRecord )
Outputs editor markup into the given TD based on given Record.
Parameters:
elCell <HTMLElement> The cell to edit.
oRecord <YAHOO.widget.Record> The DataTable Record of the cell.
Returns: void
YAHOO.widget.ColumnEditor


Copyright © 2007 Yahoo! Inc. All rights reserved.