YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Yahoo! UI Library

DataTable Widget  2.2.2

Yahoo! UI Library > datatable > DataTable

Class DataTable - uses YAHOO.util.EventProvider

DataTable class for the YUI DataTable widget.

Constructor

DataTable ( elContainer , oColumnSet , oDataSource , oConfigs )
Parameters:
elContainer <HTMLElement> Container element for the TABLE.
oColumnSet <YAHOO.widget.ColumnSet> ColumnSet instance.
oDataSource <YAHOO.util.DataSource> DataSource instance.
oConfigs <object> (optional) Object literal of configuration values.

Properties

_aSelectedRecords - private YAHOO.widget.Record[]

Array of Records that are in the selected state.

_bFocused - private Boolean

Internal variable to track whether widget has focus.

_elBody - private HTMLElement

TBODY element reference.

_elContainer - private HTMLElement

Container element reference. Is null unless the TABLE is built from scratch into the provided container.

_elFirstRow - private HTMLElement

First TR element reference pointer.

_elLastRow - private HTMLElement

Last TR element reference pointer.

_elTable - private HTMLElement

TABLE element reference.

_nCount - private static Number

Internal class variable to index multiple DataTable instances.

_nIndex - private Number

Instance index.

_oColumnSet - private YAHOO.widget.ColumnSet

ColumnSet instance.

_oRecordSet - private YAHOO.widget.RecordSet

RecordSet instance.

_paginator - private Object[]

Internal object literal to track built-in paginator values.

_paginator.containers - private HTMLElement

Array of pagination container elements.

_paginator.currentPage - private Number

Tracks current page.

_paginator.dropdownOptions - private Number[] | Object[]

Internal variable to track paginator dropdown options.

_paginator.dropdowns - private HTMLElement

Array of pagination SELECT elements.

_paginator.links - private HTMLElement

Array of pagination link container elements.

_paginator.pageLinks - private Number

Internal variable to track paginator page links.

_paginator.rowsPerPage - private Number

Tracks rows per page.

_paginator.totalPages - private Number

Tracks total number of pages, calculated on the fly.

_selectRowAnchorId - private String

Id of anchor row for multiple selections.

_sName - private String

Unique instance name.

caption - String

Defines value of CAPTION attribute.

CLASS_BODY - static final String

Class name assigned to TBODY element that holds data rows.
Default Value: "yui-dt-body"

CLASS_CHECKBOX - static final String

Class name assigned to TD elements of type "checkbox".
Default Value: "yui-dt-checkbox"

CLASS_CURRENCY - static final String

Class name assigned to TD elements of type "currency".
Default Value: "yui-dt-currency"

CLASS_CURRENTPAGE - static final String

Class name assigned to pagination links for specific page numbers that are disabled.
Default Value: "yui-dt-currentpage"

CLASS_DATE - static final String

Class name assigned to TD elements of type "date".
Default Value: "yui-dt-date"

CLASS_EDITABLE - static final String

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

CLASS_EDITOR - static final String

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

CLASS_EMAIL - static final String

Class name assigned to TD elements of type "email".
Default Value: "yui-dt-email"

CLASS_EMPTY - static final String

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

CLASS_ERROR - static final String

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

CLASS_EVEN - static final String

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

CLASS_FIRST - static final String

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

CLASS_FIRSTLINK - static final String

Class name assigned to the pagination link "<<".
Default Value: "yui-dt-firstlink"

CLASS_FIRSTPAGE - static final String

Class name assigned to the pagination link "<<" when it is disabled.
Default Value: "yui-dt-firstpage"

CLASS_HEADCONTAINER - static final String

Class name assigned to container element within THEAD.

CLASS_HEADRESIZER - static final String

Class name assigned to resizer handle element within THEAD.
Default Value: "yui-dt-headresizer"

CLASS_HEADTEXT - static final String

Class name assigned to text displayed within THEAD.
Default Value: "yui-dt-headtext"

CLASS_HIGHLIGHT - static final String

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

CLASS_LAST - static final String

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

CLASS_LASTLINK - static final String

Class name assigned to the pagination link ">>".
Default Value: "yui-dt-lastlink"

CLASS_LASTPAGE - static final String

Class name assigned to the pagination link ">>" when it is disabled.
Default Value: "yui-dt-lastpage"

CLASS_LINK - static final String

Class name assigned to TD elements of type "link".
Default Value: "yui-dt-link"

CLASS_LOADING - static final String

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

CLASS_NEXTLINK - static final String

Class name assigned to the pagination link ">".
Default Value: "yui-dt-nextlink"

CLASS_NEXTPAGE - static final String

Class name assigned to the pagination link ">" when it is disabled.
Default Value: "yui-dt-nextpage"

CLASS_NUMBER - static final String

Class name assigned to TD elements of type "number".
Default Value: "yui-dt-number"

CLASS_ODD - static final String

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

CLASS_PAGELINK - static final String

Class name assigned to pagination links to specific page numbers.
Default Value: "yui-dt-pagelink"

CLASS_PAGELINKS - static final String

Class name assigned to the pagination links container element.
Default Value: "yui-dt-pagelinks"

CLASS_PAGESELECT - static final String

Class name assigned to the pagination SELECT element.
Default Value: "yui-dt-pageselect"

CLASS_PAGINATOR - static final String

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

CLASS_PREVLINK - static final String

Class name assigned to the pagination link "<".
Default Value: "yui-dt-prevlink"

CLASS_PREVPAGE - static final String

Class name assigned to the pagination link "<" when it is disabled.
Default Value: "yui-dt-prevpage"

CLASS_SCROLLABLE - static final String

Class name assigned to container of a scrollable DataTable.
Default Value: "yui-dt-scrollable"

CLASS_SCROLLBODY - static final String

Class name assigned to scrolling TBODY element of a scrollable DataTable.
Default Value: "yui-dt-scrollbody"

CLASS_SELECTED - static final String

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

CLASS_SORTABLE - static final String

Class name assigned to column headers of sortable Columns.
Default Value: "yui-dt-sortable"

CLASS_SORTEDBYASC - static final String

Class name assigned to column headers when sorted in ascending order.
Default Value: "yui-dt-sortedbyasc"

CLASS_SORTEDBYDESC - static final String

Class name assigned to column headers when sorted in descending order.
Default Value: "yui-dt-sortedbydesc"

CLASS_STRING - static final String

Class name assigned to TD elements of type "string".
Default Value: "yui-dt-string"

CLASS_TABLE - static final String

Class name assigned to TABLE element.
Default Value: "yui-dt"

contextMenu - YAHOO.widget.ContextMenu

ContextMenu instance.

dataSource - YAHOO.util.DataSource

DataSource instance.

fixedWidth - Boolean

True if DataTable's width is a fixed size.
Default Value: false

initialRequest - String

Initial request to send to DataSource.
Default Value: ""

isEmpty - object

Deprecated: No longer used.

isLoading - object

Deprecated: No longer used.

MSG_EMPTY - static final String

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

MSG_ERROR - static final String

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

MSG_LOADING - static final String

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

pageCurrent - object

Deprecated: Deprecated. Please use paginatorOptions.currentPage

pageLinksLength - object

Deprecated: Deprecated. Please use paginatorOptions.pageLinks

pageLinksStart - object

Deprecated: Deprecated. Please use paginatorOptions.pageLinksStart.

pagers - object

Deprecated: Deprecated. Please use paginatorOptions.containers

paginator - Boolean

True if built-in paginator is enabled.
Default Value: false

paginatorOptions - Object

Object literal of initial paginator key:value properties.
Default Value: {}

paginatorOptions.containers - HTMLElement[]

Array of container elements to hold paginator UI, if enabled. If null, 2 containers will be created dynamically, one before and one after the TABLE element.
Default Value: null

paginatorOptions.currentPage - Number

If built-in paginator is enabled, current page to display.
Default Value: 1

paginatorOptions.dropdownOptions - Number[] | Object{}

Values to show in the SELECT dropdown. Can be an array of numbers to populate each OPTION's value and text with the same value, or an array of object literals of syntax {value:myValue, text:myText} will populate OPTION with corresponding value and text. A null value or empty array prevents the dropdown from displayed altogether.

paginatorOptions.pageLinks - Number

Maximum number of links to page numbers to show in paginator UI. Any pages not linked would be available through the next/previous style links. A 0 value displays all page links. A negative value disables all page links.
Default Value: 0

paginatorOptions.rowsPerPage - Number

If built-in paginator is enabled, each page will display up to the given number of rows per page. A value less than 1 will display all available rows.
Default Value: 500

rowSingleSelect - Boolean

True if only one row may be selected at a time.
Default Value: false

rowsPerPage - object

Deprecated: Deprecated. Please use paginatorOptions.rowsPerPage

rowsPerPageDropdown - object

Deprecated: Deprecated. Please use paginatorOptions.dropdownOptions

scrollable - Boolean

True if TBODY should scroll while THEAD remains fixed.
Default Value: false

sortedBy - Object

Object literal holds sort metadata: sortedBy.colKey sortedBy.dir

startRecordIndex - object

Deprecated: Deprecated. Please use paginatorOptions.startRecordIndex.

summary - String

Defines value of SUMMARY attribute.

Methods

_addRecords

private String _addRecords ( oData , index )
Creates a new Record to add to RecordSet at position i if given, or to the end otherwise.
Parameters:
oData <YAHOO.widget.Record> Array of object literals containing data.
index <Number> Index position at which to add Record.
Returns: String
Array of Records.

_addRowEl

private String _addRowEl ( oRecord , index )
Add a new TR element to table body at position i if given, or to the bottom otherwise. Populates cells with data from given Record.
Parameters:
oRecord <YAHOO.widget.Record> Record instance.
index <Number> Index position at which to add TR.
Returns: String
ID of the added TR element.

_deleteRecord

private void _deleteRecord ( identifier )
Deletes a given Record from the RecordSet.
Parameters:
identifier <Number | String> Record identifier.
Returns: void

_deleteRowEl

private void _deleteRowEl ( row )
Deletes a given TR element.
Parameters:
row <HTMLElement | Number> HTML TR element reference or position index.
Returns: void

_initHead

private void _initHead ( )
Populates THEAD element with TH cells as defined by ColumnSet.
Returns: void

_initHeadCell

private void _initHeadCell ( elHeadCell , oColumn , row , col )
Populates TH cell as defined by Column.
Parameters:
elHeadCell <HTMLElement> TH cell element reference.
oColumn <YAHOO.widget.Column> Column object.
row <number> Row index.
col <number> Column index.
Returns: void

_initPaginator

private void _initPaginator ( )
If pagination is enabled, initializes paginator container elements and sets internal tracking variables.
Returns: void

_initTable

private void _initTable ( )
Creates HTML markup for TABLE, THEAD, TBODY.
Returns: void

_onBlur

private void _onBlur ( e , oSelf )
Handles blur events on the TABLE element.
Parameters:
e <HTMLEvent> The blur event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onClick

private void _onClick ( e , oSelf )
Handles click events on the TABLE element.
Parameters:
e <HTMLEvent> The click event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onDocumentClick

private void _onDocumentClick ( e , oSelf )
Handles click events on the DOCUMENT. Hides active editor.
Parameters:
e <HTMLEvent> The click event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onDocumentKeydown

private void _onDocumentKeydown ( e , oSelf )
Handles keydown events on the DOCUMENT. Executes interaction with editor.
Parameters:
e <HTMLEvent> The key event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onDoubleclick

private void _onDoubleclick ( e , oSelf )
Handles doubleclick events on the TABLE element.
Parameters:
e <HTMLEvent> The doubleclick event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onKeydown

private void _onKeydown ( e , oSelf )
Handles keydown events on the TABLE. Executes arrow selection.
Parameters:
e <HTMLEvent> The key event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onKeypress

private void _onKeypress ( e , oSelf )
Handles keypress events on the TABLE. Mainly to support stopEvent on Mac.
Parameters:
e <HTMLEvent> The key event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onKeyup

private void _onKeyup ( e , oSelf )
Handles keyup events on the TABLE. Executes deletion
Parameters:
e <HTMLEvent> The key event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onMousedown

private void _onMousedown ( e , oSelf )
Handles mousedown events on the TABLE element.
Parameters:
e <HTMLEvent> The mousedown event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onMouseout

private void _onMouseout ( e , oSelf )
Handles mouseout events on the TABLE element.
Parameters:
e <HTMLEvent> The mouseout event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onMouseover

private void _onMouseover ( e , oSelf )
Handles mouseover events on the TABLE element.
Parameters:
e <HTMLEvent> The mouseover event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onPagerClick

private void _onPagerClick ( e , oSelf )
Handles click events on paginator links.
Parameters:
e <HTMLEvent> The click event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onPagerSelect

private void _onPagerSelect ( e , oSelf )
Handles change events on paginator SELECT.
Parameters:
e <HTMLEvent> The change event.
oSelf <YAHOO.widget.DataTable> DataTable instance.
Returns: void

_onRowDelete

private void _onRowDelete ( oArgs.rowIndexes )
Handles row delete events.
Parameters:
oArgs.rowIndexes <Number[]> The indexes of the deleted rows.
Returns: void

_select

private void _select ( els )
Sets elements to selected state. Does not fire any events. Does not affect internal tracker.
Parameters:
els <HTMLElement | String | HTMLElement[] | String[]> HTML element by reference or ID string, or array of HTML elements by reference or ID string.
Returns: void

_setFirstRow

private void _setFirstRow ( )
Sets first row with class YAHOO.widget.DataTable.CLASS_FIRST.
Returns: void

_setLastRow

private void _setLastRow ( )
Sets last row with class YAHOO.widget.DataTable.CLASS_LAST.
Returns: void

_setRowStripes

private void _setRowStripes ( range )
Stripes rows by applying class YAHOO.widget.DataTable.CLASS_EVEN or YAHOO.widget.DataTable.CLASS_ODD.
Parameters:
range <Number> (optional) Range defines a subset of rows to stripe.
Returns: void

_unselect

private void _unselect ( els )
Sets elements to the unselected state. Does not fire any events. Does not affect internal tracker.
Parameters:
els <HTMLElement | String | HTMLElement[] | String[]> HTMLElement by reference or ID string, or array of HTML elements by reference or ID string.
Returns: void

_unselectAllCells

private void _unselectAllCells ( )
Unselects all selected cells.
Returns: void

_unselectAllRows

private void _unselectAllRows ( )
Unselects all selected rows. Does not fire any events. Does not affect internal tracker.
Returns: void

_updateRowEl

private String _updateRowEl ( oRecord , index )
Updates all cells of existing TR element at given position with data from the given Record.
Parameters:
oRecord <YAHOO.widget.Record> Record instance.
index <Number> Position at which to update row.
Returns: String
ID of the updated TR element.

addRow

void addRow ( oRecord , index )
Convenience method to add a new row to table body at position index if given, or to the bottom otherwise.
Parameters:
oRecord <YAHOO.widget.Record> Record instance.
index <Number> (optional) Position at which to add row.
Returns: void

appendRows

void appendRows ( aRecords )
Add rows to bottom of table body.
Parameters:
aRecords <YAHOO.widget.Record[]> Array of Records.
Returns: void

cancelEditorData

void cancelEditorData ( )
Hides active editor, not saving any data.
Returns: void

deleteRow

void deleteRow ( elRow )
Deletes a given row element as well its corresponding Record in the RecordSet.
Parameters:
elRow <HTMLElement> HTML table row element reference.
Returns: void

deleteRows

void deleteRows ( elRows )
Calls delete on given rows.
Parameters:
elRows <HTMLElement[]> Array of HTML table row element reference.
Returns: void

doBeforeLoadData

Boolean doBeforeLoadData ( sRequest , oResponse )
Overridable method gives implementers a hook to access data before it gets added to RecordSet and rendered to the TBODY.
Parameters:
sRequest <String> Original request.
oResponse <Object> Response object.
Returns: Boolean
Return true to continue loading data into RecordSet and updating DataTable with new Records, false to cancel.

editCell

void editCell ( elCell )
Shows editor for given cell.
Parameters:
elCell <HTMLElement> Cell element to edit.
Returns: void

focusTable

void focusTable ( )
Sets focus on the TABLE element.
Returns: void

formatCell

void formatCell ( elCell )
Formats given cell.
Parameters:
elCell <HTMLElement> Cell element to format.
Returns: void

formatPaginatorDropdown

void formatPaginatorDropdown ( oElReferences )
Updates Paginator dropdown. If dropdown doesn't exist, the markup is created. Sets dropdown's "selected" value.
Parameters:
oElReferences <Object> Object literal of pointers to Paginator UI elements.
Returns: void

formatPaginatorLinks

void formatPaginatorLinks ( )
Updates Paginator links container with markup.
Returns: void

formatPaginators

void formatPaginators ( )
Updates Paginator containers with markup. Override this method to customize pagination UI.
Returns: void

getBody

HTMLElement getBody ( )
Returns element reference to TBODY.
Returns: HTMLElement
Reference to TBODY element.

getCell

HTMLElement getCell ( rowIndex , colIndex )
Returns element reference to TD element at given row and column positions.
Parameters:
rowIndex <Number> Row index.
colIndex <Number> Column index.
Returns: HTMLElement
Reference to TD element.

getColumnSet

YAHOO.widget.ColumnSet getColumnSet ( )
Returns pointer to the DataTable instance's ColumnSet instance.
Returns: YAHOO.widget.ColumnSet
ColumnSet instance.

getFirstRow

HTMLElement getFirstRow ( )
Returns element reference to first TR element.
Returns: HTMLElement
Reference to first TR element.

getHead

HTMLElement getHead ( )
Returns element reference to THEAD.
Returns: HTMLElement
Reference to THEAD element.

getLastRow

HTMLElement getLastRow ( )
Returns element reference to last TR element.
Returns: HTMLElement
Reference to last TR element.

getPaginator

Object getPaginator ( )
Returns paginator object literal.
Returns: Object
Paginator object literal with following properties:
  • currentPage: current page number
  • dropdownOptions: array of numbers to show in dropdown
  • elements: array of object literals that define where to show paginator UI with following properties:
    • container: element reference to paginator container
    • links: element reference to page links container
    • select: element reference to dropdown
  • pageLinks: number of page links displayed
  • pageLinkStart: page number of first link
  • rowsPerPage: number of rows displayed
  • totalPages: total number of pages

getRecordSet

YAHOO.widget.RecordSet getRecordSet ( )
Returns pointer to the DataTable instance's RecordSet instance.
Returns: YAHOO.widget.RecordSet
RecordSet instance.

getRow

HTMLElement getRow ( index )
Returns element reference to TR element at given index.
Parameters:
index <Number> Row number.
Returns: HTMLElement
Reference to TR element.

getSelectedCells

HTMLElement[] getSelectedCells ( )
Returns array of selected TD cells.
Returns: HTMLElement[]
Array of selected TD elements.

getSelectedRecordIds

HTMLElement[] getSelectedRecordIds ( )
Returns array of selected Record IDs.
Returns: HTMLElement[]
Array of selected TR elements.

getSelectedRows

HTMLElement[] getSelectedRows ( )
Returns array of selected rows.
Returns: HTMLElement[]
Array of selected TR elements.

getTable

HTMLElement getTable ( )
Returns element reference to TABLE.
Returns: HTMLElement
Reference to TABLE element.

hideTableMessage

void hideTableMessage ( )
Hide placeholder message.
Returns: void

hideTableMessages

void hideTableMessages ( )
Returns: void
Deprecated Deprecated. Please use hideTableMessage().

highlight

void highlight ( els )
Sets one or more elements to the highlighted state.
Parameters:
els <HTMLElement | String | HTMLElement[] | String[]> HTML TR element reference, TR String ID, array of HTML TR element, or array of TR element IDs.
Returns: void

insertRows

void insertRows ( aRecords )
Add rows to top of table body.
Parameters:
aRecords <YAHOO.widget.Record[]> Array of Records.
Returns: void

isSelected

Boolean isSelected ( el )
Returns true if given element is select, false otherwise.
Parameters:
el <HTMLElement> HTML element reference or ID.
Returns: Boolean
True if element is selected.

onDataReturnAppendRows

void onDataReturnAppendRows ( sRequest , oResponse , bError )
Add new data to end of table.
Parameters:
sRequest <String> Original request.
oResponse <Object> Response object.
bError <Boolean> (optional) True if there was a data error.
Returns: void

onDataReturnInsertRows

void onDataReturnInsertRows ( sRequest , oResponse , bError )
Handles data return for inserting new rows to top of table.
Parameters:
sRequest <String> Original request.
oResponse <Object> Response object.
bError <Boolean> (optional) True if there was a data error.
Returns: void

onDataReturnPaginateRows

void onDataReturnPaginateRows ( )
Returns: void
Deprecated Deprecated. Please use onDataReturnPopulateTable().

onDataReturnPopulateTable

void onDataReturnPopulateTable ( sRequest , oResponse , bError )
Calls populateTable() with new data.
Parameters:
sRequest <String> Original request.
oResponse <Object> Response object.
bError <Boolean> (optional) True if there was a data error.
Returns: void

onDataReturnReplaceRows

void onDataReturnReplaceRows ( sRequest , oResponse , bError )
Handles data return for replacing all existing of table with new rows.
Parameters:
sRequest <String> Original request.
oResponse <Object> Response object.
bError <Boolean> (optional) True if there was a data error.
Returns: void

onEventEditCell

void onEventEditCell ( oArgs.event , oArgs.target )
Overridable custom event handler to edit cell.
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

onEventFormatCell

void onEventFormatCell ( oArgs.event , oArgs.target )
Overridable custom event handler to format cell.
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

onEventHighlightCell

void onEventHighlightCell ( oArgs.event , oArgs.target )
Overridable custom event handler to highlight cell.
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

onEventSelectCell

void onEventSelectCell ( oArgs.event , oArgs.target )
Overridable custom event handler to select cell.
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

onEventSelectRow

void onEventSelectRow ( oArgs.event , oArgs.target )
Overridable custom event handler to select row according to desktop paradigm.
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

onEventSortColumn

void onEventSortColumn ( oArgs.event , oArgs.target )
Overridable custom event handler to sort column.
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

onEventUnhighlightCell

void onEventUnhighlightCell ( oArgs.event , oArgs.target )
Overridable custom event handler to unhighlight cell.
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

populateTable

void populateTable ( oData )
Replaces all Records in RecordSet and populates TBODY rows with the new data. Blows away old data. If pagination is enabled, displays only current page, otherwise displays all rows.
Parameters:
oData <Object | Object[]> An object literal of data or an array of object literals containing data.
Returns: void
Deprecated Deprecated in favor of populateTable().

refreshTable

void refreshTable ( )
Refreshes table view into existing RecordSet. For performance, reuses existing rows while deleting extraneous rows.
Returns: void

saveEditorData

void saveEditorData ( )
Saves data in active editor.
Returns: void

select

void select ( els )
Sets one or more elements to the selected state.
Parameters:
els <HTMLElement | String | HTMLElement[] | String[]> HTML TR element reference, TR String ID, array of HTML TR element, or array of TR element IDs.
Returns: void

selectRow

void selectRow ( row )
Sets a row to the selected state.
Parameters:
row <HTMLElement | String> HTML TR element reference or ID.
Returns: void

showEmptyMessage

void showEmptyMessage ( )
Returns: void
Deprecated Deprecated. Please use showTableMessage().

showLoadingMessage

void showLoadingMessage ( )
Returns: void
Deprecated Deprecated. Please use showTableMessage().

showPage

void showPage ( nPage )
Displays a specific page of a paginated DataTable.
Parameters:
nPage <Number> Which page.
Returns: void

showTableMessage

void showTableMessage ( sHTML , sClassName )
Displays placeholder row with a message when there are no data rows.
Parameters:
sHTML <String> (optional) Value for innerHTML.
sClassName <String> (optional) Classname.
Returns: void

sortColumn

void sortColumn ( oColumn )
Sort given column.
Parameters:
oColumn <YAHOO.widget.Column> Column instance.
Returns: void

toString

String toString ( )
Public accessor to the unique name of the DataSource instance.
Returns: String
Unique name of the DataSource instance.

unhighlight

void unhighlight ( els )
Sets one or more elements to the unhighlighted state.
Parameters:
els <HTMLElement | String | HTMLElement[] | String[]> HTML TR element reference, TR String ID, array of HTML TR element, or array of TR element IDs.
Returns: void

unselect

void unselect ( els )
Sets one or more elements to the unselected state.
Parameters:
els <HTMLElement | String | HTMLElement[] | String[]> HTML element reference, element ID, array of HTML elements, or array of element IDs
Returns: void

unselectAllCells

void unselectAllCells ( )
Unselects all selected cells.
Returns: void

unselectAllRows

void unselectAllRows ( )
Unselects all selected rows (across all pages, if applicable).
Returns: void

unselectRow

void unselectRow ( row )
Sets a row to the unselected state.
Parameters:
row <HTMLElement | String> HTML TR element reference or ID.
Returns: void

updatePaginator

void updatePaginator ( )
Updates Paginator internal values and UI.
Returns: void

updateRow

void updateRow ( oRecord , index )
Updates existing Record and row at position index with given data.
Parameters:
oRecord <YAHOO.widget.Record> Record instance.
index <Number> Position at which to update row.
Returns: void

Events

_onRecordUpdate

private _onRecordUpdate ( oArgs.record , oArgs.key , oArgs.newData , oArgs.oldData )
Passes along recordSetUpdate Event when recordUpdateEvent is caught from RecordSet.
Parameters:
oArgs.record <YAHOO.widget.Record> The Record instance.
oArgs.key <String> The Record key.
oArgs.newData <Object> New data.
oArgs.oldData <Object> New data.

cellClickEvent

cellClickEvent ( oArgs.event , oArgs.target )
Fired when a TD element is clicked.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TD element.

cellDoubleclickEvent

cellDoubleclickEvent ( oArgs.event , oArgs.target )
Fired when a TD element is doubleclicked.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TD element.

cellEditEvent

cellEditEvent ( oArgs.target , oArgs.newData , oArgs.oldData )
Fired when a cell is edited.
Parameters:
oArgs.target <HTMLElement> The TD element.
oArgs.newData <Object> New data value.
oArgs.oldData <Object> Old data value.

cellFormatEvent

cellFormatEvent ( oArgs.el )
Fired when a TD element is formatted.
Parameters:
oArgs.el <HTMLElement> Reference to the TD element.

cellMousedownEvent

cellMousedownEvent ( oArgs.event , oArgs.target )
Fired when a mousedown occurs on a TD element.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TD element.

cellMouseoutEvent

cellMouseoutEvent ( oArgs.event , oArgs.target )
Fired when a mouseout occurs on a TD element.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TD element.

cellMouseoverEvent

cellMouseoverEvent ( oArgs.event , oArgs.target )
Fired when a mouseover occurs on a TD element.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TD element.

checkboxClickEvent

checkboxClickEvent ( oArgs.event , oArgs.target )
Fired when a CHECKBOX element is clicked.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The CHECKBOX element.

columnResizeEvent

columnResizeEvent ( oArgs.target )
Fired when a column is resized.
Parameters:
oArgs.target <HTMLElement> The TH element.

columnSortEvent

columnSortEvent ( oArgs.column , oArgs.dir )
Fired when a column is sorted.
Parameters:
oArgs.column <YAHOO.widget.Column> The Column instance.
oArgs.dir <String> Sort direction "asc" or "desc".

dataReturnEvent

dataReturnEvent ( oArgs.request , oArgs.response )
Fired when data is returned from DataSource.
Parameters:
oArgs.request <String> Original request.
oArgs.response <Object> Response object.

editorShowEvent

editorShowEvent ( oArgs.target , oArgs.column )
Fired when an editor is activated.
Parameters:
oArgs.target <HTMLElement> The TD element.
oArgs.column <YAHOO.widget.Column> The Column instance.

headCellClickEvent

headCellClickEvent ( oArgs.event , oArgs.target )
Fired when a TH cell element is clicked.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TH element.

headCellDoubleclickEvent

headCellDoubleclickEvent ( oArgs.event , oArgs.target )
Fired when a TH cell element is doubleclicked.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TH element.

headCellMousedownEvent

headCellMousedownEvent ( oArgs.event , oArgs.target )
Fired when a TH cell element is mousedown.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TH element.

headCellMouseoutEvent

headCellMouseoutEvent ( oArgs.event , oArgs.target )
Fired when a TH cell element is mouseout.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TH element.

headCellMouseoverEvent

headCellMouseoverEvent ( oArgs.event , oArgs.target )
Fired when a TH cell element is mouseover.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TH element.

highlightEvent

highlightEvent ( oArgs.els )
Fired when an element is highlighted.
Parameters:
oArgs.els <Array> An array of the highlighted element(s).

paginateEvent

paginateEvent ( )
Fired when DataTable is paginated.

radioClickEvent

radioClickEvent ( oArgs.event , oArgs.target )
Fired when a RADIO element is clicked.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The RADIO element.

recordSetUpdateEvent

recordSetUpdateEvent ( oArgs.record , oArgs.key , oArgs.newData , oArgs.oldData )
Fired when a Record is updated in the RecordSet.
Parameters:
oArgs.record <YAHOO.widget.Record> The Record instance.
oArgs.key <String> The Record key.
oArgs.newData <Object> New data.
oArgs.oldData <Object> New data.

rowAppendEvent

rowAppendEvent ( oArgs.rowIds )
Fired when one or more TR elements are appended.
Parameters:
oArgs.rowIds <Array> The IDs of the appended rows.

rowDeleteEvent

rowDeleteEvent ( oArgs.rowIndexes )
Fired when one or more TR elements are deleted.
Parameters:
oArgs.rowIndexes <Array> The indexes of the deleted rows.

rowSelectEvent

rowSelectEvent ( oArgs.el , oArgs.record )
Fired when a TR element is selected.
Parameters:
oArgs.el <HTMLElement> The selected TR element.
oArgs.record <YAHOO.widget.Record> The associated Record instance.

rowUnselectEvent

rowUnselectEvent ( oArgs.el , oArgs.record )
Fired when a TR element is unselected.
Parameters:
oArgs.el <HTMLElement> The unselected TR element.
oArgs.record <YAHOO.widget.Record> The associated Record instance.

rowUpdateEvent

rowUpdateEvent ( oArgs.rowIds )
Fired when one or more TR elements are updated.
Parameters:
oArgs.rowIds <Array> The IDs of the updated rows.

selectEvent

selectEvent ( oArgs.els )
Fired when an element is selected.
Parameters:
oArgs.els <Array> An array of the selected element(s).

tableClickEvent

tableClickEvent ( oArgs.event , oArgs.target )
Fired when a TABLE element is clicked.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TABLE element.

tableDoubleclickEvent

tableDoubleclickEvent ( oArgs.event , oArgs.target )
Fired when a TABLE element is doubleclicked.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TABLE element.

tableFocusEvent

tableFocusEvent ( )
Fired when DataTable instance is focused.

tableInitEvent

tableInitEvent ( )
Fired when DataTable instance is first initialized.

tableMousedownEvent

tableMousedownEvent ( oArgs.event , oArgs.target )
Fired when a TABLE element is mousedown.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TABLE element.

tableMouseoutEvent

tableMouseoutEvent ( oArgs.event , oArgs.target )
Fired when a TABLE element is mouseout.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TABLE element.

tableMouseoverEvent

tableMouseoverEvent ( oArgs.event , oArgs.target )
Fired when a TABLE element is mouseover.
Parameters:
oArgs.event <HTMLEvent> The event object.
oArgs.target <HTMLElement> The TABLE element.

tableRefreshEvent

tableRefreshEvent ( )
Fired when DataTable view is refreshed.

unhighlightEvent

unhighlightEvent ( oArgs.els )
Fired when an element is unhighlighted.
Parameters:
oArgs.els <Array> An array of the unhighlighted element(s).

unselectEvent

unselectEvent ( oArgs.els )
Fired when an element is unselected.
Parameters:
oArgs.els <Array> An array of the unselected element(s).


Copyright © 2007 Yahoo! Inc. All rights reserved.