Yahoo! UI Library

DataTable Widget  2.6.0

Yahoo! UI Library > datatable > YAHOO.widget.DataTable

Class YAHOO.widget.DataTable - extends Element

Known Subclasses:
YAHOO.widget.ScrollingDataTable
DataTable class for the YUI DataTable widget.

Constructor

YAHOO.widget.DataTable ( elContainer , aColumnDefs , oDataSource , oConfigs )
Parameters:
elContainer <HTMLElement> Container element for the TABLE.
aColumnDefs <Object[]> Array of object literal Column definitions.
oDataSource <YAHOO.util.DataSource> DataSource instance.
oConfigs <object> (optional) Object literal of configuration values.

Properties

_aDynFunctions - private Array

Sparse array of custom functions to set column widths for browsers that don't support dynamic CSS rules. Functions are added at the index representing the number of rows they update.

_aSelections - private Object[]

Array to track row selections (by sRecordId) and/or cell selections (by {recordId:sRecordId, columnKey:sColumnKey})

_bInit - private Boolean

True if instance is initialized, so as to fire the initEvent after render.
Default Value: true

_elCaption - private HTMLElement

DOM reference to the CAPTION element for the DataTable instance.

_elColgroup - private HTMLElement

DOM reference to the COLGROUP element for the DataTable instance.

_elContainer - private HTMLElement

DOM reference to the container element for the DataTable instance into which all other elements get created.

_elMask - private HTMLElement

DOM reference to the mask element for the DataTable instance which disables it.

_elMsgTbody - private HTMLElement

DOM reference to the secondary TBODY element used to display DataTable messages.

_elMsgTd - private HTMLElement

DOM reference to the secondary TBODY element's single TD element used to display DataTable messages.

_elMsgTr - private HTMLElement

DOM reference to the secondary TBODY element's single TR element used to display DataTable messages.

_elTable - private HTMLElement

DOM reference to the TABLE element for the DataTable instance.

_elTbody - private HTMLElement

DOM reference to the primary TBODY element for the DataTable instance.

_elThead - private HTMLElement

DOM reference to the THEAD element for the DataTable instance.

_elTrTemplate - private {HTMLElement}

Template row to create all new rows from.

_nIndex - private Number

Index assigned to instance.

_nTdCount - private Number

Counter for IDs assigned to TD elements.

_nTrCount - private Number

Counter for IDs assigned to TR elements.

_oAnchorCell - private Object

Object literal representing cell selection anchor: {recordId:sRecordId, columnKey:sColumnKey}.

_oAnchorRecord - private YAHOO.widget.Record

Record instance of the row selection anchor.

_oCellEditor - private YAHOO.widget.CellEditor

The active CellEditor instance for the DataTable instance.

_oChainRender - private YAHOO.util.Chain

Render chain.

_oColumnSet - private YAHOO.widget.ColumnSet

ColumnSet instance for the DataTable instance.

_oDataSource - private YAHOO.util.DataSource

DataSource instance for the DataTable instance.

_oRecordSet - private YAHOO.widget.RecordSet

RecordSet instance for the DataTable instance.

_sFirstTrId - private String

ID string of first TR element of the current DataTable page.

_sId - private String

Unique id assigned to instance "yui-dtN", useful prefix for generating unique DOM ID strings and log messages.

_sLastTrId - private String

ID string of the last TR element of the current DataTable page.

configs - Object

Returns object literal of initial configs.
Default Value: {}

DataTable._bDynStylesFallback - private static boolean

Set to true if _elDynStyleNode cannot be populated due to browser incompatibility.

DataTable._elColumnDragTarget - private static HTMLElement

Element reference to shared Column drag target.

DataTable._elColumnResizerProxy - private static HTMLElement

Element reference to shared Column resizer proxy.

DataTable._elDynStyleNode - private static HTMLElement

Reference to the STYLE node that is dynamically created and updated in order to manage Column widths.

DataTable._nCount - private static Number

Internal class variable for indexing multiple DataTable instances.

DataTable._nCurrentCount - private static Number

Internal class variable tracking current number of DataTable instances, so that certain class values can be reset when all instances are destroyed.

DataTable._oDynStyles - private static Object

Object literal hash of Columns and their dynamically create style rules.

DataTable.CLASS_ASC - static final String

Class name assigned to ascending elements.
Default Value: "yui-dt-asc"

DataTable.CLASS_BUTTON - static final String

Class name assigned to BUTTON elements and/or container elements.
Default Value: "yui-dt-button"

DataTable.CLASS_CHECKBOX - static final String

Class name assigned to INPUT TYPE=CHECKBOX elements and/or container elements.
Default Value: "yui-dt-checkbox"

DataTable.CLASS_COLTARGET - static final String

Class name assigned to Column drag target.
Default Value: "yui-dt-coltarget"

DataTable.CLASS_DATA - static final String

Class name assigned to data elements.
Default Value: "yui-dt-data"

DataTable.CLASS_DATATABLE - static final String

Class name assigned to outer DataTable container.
Default Value: "yui-dt"

DataTable.CLASS_DEFAULT - static final String

Class name assigned to default indicators.
Default Value: "yui-dt-default"

DataTable.CLASS_DESC - static final String

Class name assigned to descending elements.
Default Value: "yui-dt-desc"

DataTable.CLASS_DISABLED - static final String

Class name assigned to disabled elements.
Default Value: "yui-dt-disabled"

DataTable.CLASS_DRAGGABLE - static final String

Class name assigned to draggable elements.
Default Value: "yui-dt-draggable"

DataTable.CLASS_DROPDOWN - static final String

Class name assigned to SELECT elements and/or container elements.
Default Value: "yui-dt-dropdown"

DataTable.CLASS_EDITABLE - static final String

Class name assigned to editable elements.
Default Value: "yui-dt-editable"

DataTable.CLASS_EDITOR - static final String

Class name assigned to CellEditor container elements.
Default Value: "yui-dt-editor"

DataTable.CLASS_EMPTY - static final String

Class name assigned to empty indicators.
Default Value: "yui-dt-empty"

DataTable.CLASS_ERROR - static final String

Class name assigned to error indicators.
Default Value: "yui-dt-error"

DataTable.CLASS_EVEN - static final String

Class name assigned to even elements.
Default Value: "yui-dt-even"

DataTable.CLASS_FIRST - static final String

Class name assigned to first elements.
Default Value: "yui-dt-first"

DataTable.CLASS_HIDDEN - static final String

Class name assigned to hidden elements.
Default Value: "yui-dt-hidden"

DataTable.CLASS_HIGHLIGHTED - static final String

Class name assigned to highlighted elements.
Default Value: "yui-dt-highlighted"

DataTable.CLASS_LABEL - static final String

Class name assigned to display label elements.
Default Value: "yui-dt-label"

DataTable.CLASS_LAST - static final String

Class name assigned to last elements.
Default Value: "yui-dt-last"

DataTable.CLASS_LINER - static final String

Class name assigned to liner DIV elements.
Default Value: "yui-dt-liner"

DataTable.CLASS_LOADING - static final String

Class name assigned to loading indicatorx.
Default Value: "yui-dt-loading"

DataTable.CLASS_MASK - static final String

Class name assigned to mask element when DataTable is disabled.
Default Value: "yui-dt-mask"

DataTable.CLASS_MESSAGE - static final String

Class name assigned to messaging elements.
Default Value: "yui-dt-message"

DataTable.CLASS_NEXT - static final String

Class name assigned next indicators.
Default Value: "yui-dt-next"

DataTable.CLASS_ODD - static final String

Class name assigned to odd elements.
Default Value: "yui-dt-odd"

DataTable.CLASS_PAGE - static final String

Class name assigned to page number indicators.
Default Value: "yui-dt-page"

DataTable.CLASS_PAGINATOR - static final String

Class name assigned to paginator container elements.
Default Value: "yui-dt-paginator"

DataTable.CLASS_PREVIOUS - static final String

Class name assigned to previous indicators.
Default Value: "yui-dt-previous"

DataTable.CLASS_RADIO - static final String

Class name assigned to INPUT TYPE=RADIO elements and/or container elements.
Default Value: "yui-dt-radio"

DataTable.CLASS_RESIZEABLE - static final String

Class name assigned to resizeable elements.
Default Value: "yui-dt-resizeable"

DataTable.CLASS_RESIZER - static final String

Class name assigned to resizer handle elements.
Default Value: "yui-dt-resizer"

DataTable.CLASS_RESIZERLINER - static final String

Class name assigned to resizer liner elements.
Default Value: "yui-dt-resizerliner"

DataTable.CLASS_RESIZERPROXY - static final String

Class name assigned to resizer proxy elements.
Default Value: "yui-dt-resizerproxy"

DataTable.CLASS_SCROLLABLE - static final String

Class name assigned to scrollable elements.
Default Value: "yui-dt-scrollable"

DataTable.CLASS_SELECTED - static final String

Class name assigned to selected elements.
Default Value: "yui-dt-selected"

DataTable.CLASS_SORTABLE - static final String

Class name assigned to sortable elements.
Default Value: "yui-dt-sortable"

DataTable.Formatter - static Object

Cell formatting functions.

Methods

_clearMinWidth

private void _clearMinWidth ( oColumn )
Clears minWidth.
Parameters:
oColumn <YAHOO.widget.Column> Which Column.
Returns: void

_clearTrTemplateEl

private void _clearTrTemplateEl ( )
Clears TR element template in response to any Column state change.
Returns: void

_createTrEl

private HTMLElement _createTrEl ( oRecord )
Create a new TR element for a given Record and appends it with the correct number of Column-state-classed TD elements. Striping is the responsibility of the calling function, which may decide to stripe the single row, a subset of rows, or all the rows.
Parameters:
oRecord <YAHOO.widget.Record> Record instance
Returns: HTMLElement
The new TR element. This must be added to the DOM.

_defaultPaginatorContainers

private void _defaultPaginatorContainers ( create )
Returns the default containers used for Paginators. If create param is passed, the containers will be created and added to the DataTable container.
Parameters:
create <boolean> Create the default containers if not found
Returns: void

_deleteTrEl

private Boolean _deleteTrEl ( row )
Deletes TR element by DOM reference or by DataTable page row index.
Parameters:
row <HTMLElement | Number> TR element reference or Datatable page row index.
Returns: Boolean
Returns true if successful, else returns false.

_destroyColgroupEl

private void _destroyColgroupEl ( )
Destroy's the DataTable COLGROUP element, if available.
Returns: void

_destroyColumnHelpers

private void _destroyColumnHelpers ( )
Destroys elements associated with Column functionality: ColumnDD and ColumnResizers.
Returns: void

_destroyContainerEl

private void _destroyContainerEl ( elContainer )
Destroy's the DataTable outer container element, if available.
Parameters:
elContainer <HTMLElement> Reference to the container element.
Returns: void

_destroyDraggableColumns

private void _destroyDraggableColumns ( )
Disables DD from top-level Column TH elements.
Returns: void

_destroyMsgTbodyEl

private void _destroyMsgTbodyEl ( )
Destroy's the DataTable message TBODY element, if available.
Returns: void

_destroyResizeableColumns

private void _destroyResizeableColumns ( )
Disables resizeability on key Column TH elements.
Returns: void

_destroyTableEl

private void _destroyTableEl ( )
Destroy's the DataTable TABLE element, if available.
Returns: void

_destroyTbodyEl

private void _destroyTbodyEl ( )
Destroy's the DataTable TBODY element, if available.
Returns: void

_destroyTheadEl

private void _destroyTheadEl ( )
Destroy's the DataTable THEAD element, if available.
Returns: void

_focusEl

private void _focusEl ( el )
Sets focus on the given element.
Parameters:
el <HTMLElement> Element.
Returns: void

_formatTdEl

private HTMLElement _formatTdEl ( oColumn , elTd , index , isLast )
Formats a basic TD element.
Parameters:
oColumn <YAHOO.widget.Column> Associated Column instance.
elTd <HTMLElement> An unformatted TD element.
index <Number> Column key index.
isLast <Boolean> True if Column is last key of the ColumnSet.
Returns: HTMLElement
A formatted TD element.

_getColumnClassnames

private String _getColumnClassnames ( oColumn , aAddClasses )
Retruns classnames to represent current Column states.
Parameters:
oColumn <YAHOO.widget.Column> Column instance.
aAddClasses <String[]> An array of additional classnames to add to the return value.
Returns: String
A String of classnames to be assigned to TH or TD elements for given Column.

_getSelectionAnchor

private void _getSelectionAnchor ( oTrigger )
Returns object literal of values that represent the selection anchor. Used to determine selection behavior resulting from a user event.
Parameters:
oTrigger <Object> (Optional) Object literal of selection trigger values (for key events).
Returns: void

_getSelectionTrigger

private void _getSelectionTrigger ( )
Returns object literal of values that represent the selection trigger. Used to determine selection behavior resulting from a key event.
Returns: void

_getTrTemplateEl

private HTMLElement _getTrTemplateEl ( )
Returns a new TR element template with TD elements classed with current Column states.
Returns: HTMLElement
A TR element to be cloned and added to the DOM.

_handleCellBlockSelectionByKey

private void _handleCellBlockSelectionByKey ( e )
Determines selection behavior resulting from a key event when selection mode is set to "cellblock".
Parameters:
e <HTMLEvent> Event object.
Returns: void

_handleCellBlockSelectionByMouse

private void _handleCellBlockSelectionByMouse ( oArgs.event , oArgs.target )
Determines selection behavior resulting from a mouse event when selection mode is set to "cellblock".
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

_handleCellRangeSelectionByKey

private void _handleCellRangeSelectionByKey ( e )
Determines selection behavior resulting from a key event when selection mode is set to "cellrange".
Parameters:
e <HTMLEvent> Event object.
Returns: void

_handleCellRangeSelectionByMouse

private void _handleCellRangeSelectionByMouse ( oArgs.event , oArgs.target )
Determines selection behavior resulting from a mouse event when selection mode is set to "cellrange".
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

_handlePaginatorChange

private void _handlePaginatorChange ( e )
Update the UI infrastructure in response to a "paginator" attribute change.
Parameters:
e <Object> Change event object containing keys 'type','newValue', and 'prevValue'
Returns: void

_handleSingleCellSelectionByKey

private void _handleSingleCellSelectionByKey ( e )
Determines selection behavior resulting from a key event when selection mode is set to "singlecell".
Parameters:
e <HTMLEvent> Event object.
Returns: void

_handleSingleCellSelectionByMouse

private void _handleSingleCellSelectionByMouse ( oArgs.event , oArgs.target )
Determines selection behavior resulting from a mouse event when selection mode is set to "singlecell".
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

_handleSingleSelectionByKey

private void _handleSingleSelectionByKey ( e )
Determines selection behavior resulting from a key event when selection mode is set to "single".
Parameters:
e <HTMLEvent> Event object.
Returns: void

_handleSingleSelectionByMouse

private void _handleSingleSele