Yahoo! UI Library

RowExpansionDataTable Widget  1.0

Yahoo! UI Library > rowexpansiondatatable > YAHOO.widget.RowExpansionDataTable
Search:
 
Filters

Class YAHOO.widget.RowExpansionDataTable - extends YAHOO.widget.DataTable

The RowExpansionDataTable class extends the DataTable class to provide functionality for expanding rows to show more contextual data.

Constructor

YAHOO.widget.RowExpansionDataTable ( 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.

Methods

_destroyExpansion

private void _destroyExpansion ( recordId )
Destroys a expansion row
Parameters:
recordId <object> DOM reference to a TR element (or child of a TR element), RecordSet position index, or Record ID.
Returns: void

_initEvents

private void _initEvents ( )
Initialize internal event listeners
Returns: void

collapseAllRows

void collapseAllRows ( )
Collapses all expanded rows.
Returns: void

collapseRow

Boolean collapseRow ( recordId )
Sets the expansion state of a row to collapsed
Parameters:
recordId <Mixed> Record / Row / or Index id
Returns: Boolean
successful

deleteRow

void deleteRow ( row )
This is an override for DataTable's own deleteRow to delete the expansion row before the main row is deleted
Parameters:
row <HTMLElement | String | Number> DOM element reference or ID string to DataTable page element or RecordSet index.
Returns: void

deleteRows

void deleteRows ( row , count )
This is an override for DataTable's own deleteRows to delete the expansion rows before the main rows are deleted
Parameters:
row <HTMLElement | String | Number> DOM element reference or ID string to DataTable page element or RecordSet index.
count <Number> (optional) How many rows to delete. A negative value will delete towards the beginning.
Returns: void

destroy

void destroy ( )
Overrides DataTable's destroy method to also destroy expansion rows.
Returns: void

expandRow

Boolean expandRow ( recordId )
Sets the expansion state of a row to expanded
Parameters:
recordId <Mixed> Record / Row / or Index id
Returns: Boolean
successful

forAllRecords

void forAllRecords ( fn , scope )
Loops through all Record instances in the RecordSet
Parameters:
fn <Function> Reference to a function that will be called once for ever record. fn will receive a Record instance and the index for the record as its arguments. fn may return false to break out of the loop.
scope <Object> (optional) Scope to execute fn in. It defaults to the DataTable instance.
Returns: void

getExpansionContainer

HTMLElement getExpansionContainer ( recordId )
returns the container element for the expansion
Parameters:
recordId <Mixed> Record / Row / or Index id
Returns: HTMLElement
container element

getExpansionState

Object getExpansionState ( recordId , key )
Gets expansion state object for a specific record associated with the DataTable.
Parameters:
recordId <Mixed> Record / Row / or Index id
key <String> (optional) Key to return within the state object. Default is to return all as a map
Returns: Object
State data object or value for Key. The full state object contains
  • record: reference to the associated Record instance
  • expanded: true when the row is expanded
  • expTrEl: the TR element for the expansion row
  • expLinerEl: the container for the expansion
  • other: Developers may store extra information in it

initAttributes

void initAttributes ( configuration )
Over-ridden initAttributes method from DataTable, inherited from Element
Parameters:
configuration <Object> attributes taken from the fourth argument to the constructor
Returns: void

initializeTable

void initializeTable ( )
This is an override for DataTable's own initializeTable which it calls after it destroys all expansion rows
Returns: void

onDataReturnSetRows

void onDataReturnSetRows ( )
This is an override for DataTable's own onDataReturnSetRows which it calls after it destroys all expansion rows since with server-side pagination, with every new page it ignores the previous records
Returns: void

onEventToggleRowExpansion

void onEventToggleRowExpansion ( oArgs )
Helper method which toggles row expansion.
Parameters:
oArgs <Object> context of a subscribed event
Returns: void

restoreExpandedRows

void restoreExpandedRows ( )
Restores rows which have been expanded state but the original markup has been removed from the page.
Returns: void

setExpansionState

Object setExpansionState ( recordId , key , value )
Sets a value to a expansion state object with a given Key for a record which is associated with the DataTable
Parameters:
recordId <Mixed> Record / Row / or Index id
key <String> Key to use in map
value <Mixed> Value to assign to the key
Returns: Object
State data object

toggleRowExpansion

void toggleRowExpansion ( recordId )
Toggles the expansion state of a row
Parameters:
recordId <Mixed> Record / Row / or Index id
Returns: void

Events

beforeRowExpansionTemplateChange

beforeRowExpansionTemplateChange ( event )
Fires before the value for the configuration attribute 'rowExpansionTemplate' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

rowCollapsedEvent

rowCollapsedEvent ( state )
Fires when a row is collapsed
Parameters:
state <Object> see getExpansionState

rowExpandedEvent

rowExpandedEvent ( state )
Fires when a row is expanded
Parameters:
state <Object> see getExpansionState

rowExpansionDestroyEvent

rowExpansionDestroyEvent ( state )
Fires when a row is about to be deleted
Parameters:
state <Object> see getExpansionState

rowExpansionTemplateChange

rowExpansionTemplateChange ( event )
Fires when the value for the configuration attribute 'rowExpansionTemplate' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

Configuration Attributes

rowExpansionTemplate - {String or Function}

Template for the expansion row. If a String, it will be processed through YAHOO.lang.substitute and will have all the values in the associated Record available. If a Function, it will receive the expansion state object, see: getExpansionState
Default Value: null


Copyright © 2010 Yahoo! Inc. All rights reserved.