Yahoo! UI Library

DataTable Widget  2.5.2

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

Show Private Show Protected

Class YAHOO.widget.DataTable - uses YAHOO.util.EventProvider

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

_aFallbackColResizer - 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, columnId:sColumnId})

_bInit - private Boolean

True if instance is initialized, so as to fire the initEvent rather than renderEvent.
Default Value: true

_bScrollbarX - private {Boolean}

True if x-scrollbar is currently visible.

_elCaption - private HTMLElement

DOM reference to the CAPTION 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.

_elMsgTbody - private HTMLElement

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

_elMsgTbodyCell - private HTMLElement

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

_elMsgTbodyRow - private HTMLElement

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

_elTbody - private HTMLElement

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

_elTbodyContainer - private HTMLElement

DOM reference to the container element for the DataTable's primary TBODY.

_elThead - private HTMLElement

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

_elTheadContainer - private HTMLElement

DOM reference to the container element for the DataTable's primary THEAD.

_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, columnId:sColumnId}.

_oAnchorRecord - private YAHOO.widget.Record

Record instance of the row selection anchor.

_oChainRender - private YAHOO.util.Chain

Render chain.

_oChainSync - private YAHOO.util.Chain

Sync 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.

_sLastHighlightedTdElId - private String

ID string of last highlighted cell element

_sLastHighlightedTrElId - private String

ID string of last highlighted row element

_sLastTrId - private String

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

_tdElTemplate - private {HTMLElement}

Template cell to create all new cells from.

_trElTemplate - private {HTMLElement}

Template row to create all new rows from.

DataTable._bStylesheetFallback - private static boolean

Set to true if _elStylesheet 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._elStylesheet - private static HTMLElement

Reference to STYLE node that is dynamically created and written to 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._oStylesheetRules - 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_COLUMN_FILLER_COLOR - static final String

Color assigned to header filler on scrollable tables when columnFiller is set to true.
Default Value: "#F2F2F2"

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 Editor 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_MSG - static final String

Class name assigned to message containers.
Default Value: "yui-dt-msg"

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_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.

DataTable.MSG_EMPTY - static final String

Message to display if DataTable has no data.
Default Value: "No records found."

DataTable.MSG_ERROR - static final String

Message to display while DataTable has data error.
Default Value: "Data error."

DataTable.MSG_LOADING - static final String

Message to display while DataTable is loading data.
Default Value: "Loading data..."

Methods

_addTdEl

private HTMLElement _addTdEl ( elRow , oColumn , index )
Creates a cell within the specified row and column.
Parameters:
elRow <HTMLElement> The row to add the cell to
oColumn <Column> The column definition to use for the cell
index <number> (optional) the index to add the cell at (default null)
Returns: HTMLElement
the new cell

_addTrEl

private HTMLElement _addTrEl ( oRecord , index )
Adds one TR element at the given index and populates with given Record data.
Parameters:
oRecord <YAHOO.widget.Record> Record instance.
index <Number> TR index.
Returns: HTMLElement
Reference to new TR element.

_createTrEl

private HTMLElement _createTrEl ( oRecord )
Create a TR element for a given Record.
Parameters:
oRecord <YAHOO.widget.Record> Record instance
Returns: HTMLElement
The new TR element. This must be added to the DOM.

_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.

_focusEl

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

_forceGeckoRedraw

private void _forceGeckoRedraw ( )
Forces Gecko repaint by removing/adding the no-op class name
Returns: void

_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

_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

_handleDataReturnPayload

private void _handleDataReturnPayload ( oRequest , oResponse , meta )
Updates the DataTable with data sent in an onDataReturn* payload
Parameters:
oRequest <MIXED> Original generated request.
oResponse <Object> Response object.
meta <MIXED> Argument(s) provided in payload or response meta
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 _handleSingleSelectionByMouse ( oArgs.event , oArgs.target )
Determines selection behavior resulting from a mouse event when selection mode is set to "single".
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

_handleStandardSelectionByKey

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

_handleStandardSelectionByMouse

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

_initCellEditorEl

private void _initCellEditorEl ( )
Creates HTML markup for Cell Editor.
Returns: void

_initColumnSet

private void _initColumnSet ( aColumnDefs )
Initializes ColumnSet.
Parameters:
aColumnDefs <Object[]> Array of object literal Column definitions.
Returns: void

_initColumnSort

private void _initColumnSort ( )
Initializes Column sorting.
Returns: void

_initConfigs

private void _initConfigs ( oConfig )
Initializes object literal of config values.
Parameters:
oConfig <Object> Object literal of config values.
Returns: void

_initContainerEl

private void _initContainerEl ( elContainer )
Initializes the DataTable container element.
Parameters:
elContainer <HTMLElement | String> HTML DIV element by reference or ID.
Returns: void

_initDataSource

private void _initDataSource ( oDataSource )
Initializes DataSource.
Parameters:
oDataSource <YAHOO.util.DataSource> DataSource instance.
Returns: void