Yahoo! UI Library

NestedDataTable Widget  1.0

Yahoo! UI Library > nesteddatatable > YAHOO.widget.NestedDataTable
Search:
 
Filters

Class YAHOO.widget.NestedDataTable - extends YAHOO.widget.DataTable

NestedDataTable class for Satyam's NestedDataTable widget.

Constructor

YAHOO.widget.NestedDataTable ( elContainer , masterColDefs , masterDataSource , nestedColDefs , nestedDataSource , masterOptions , nestedOptions )
Parameters:
elContainer <HTMLElement> Container element for the TABLE.
masterColDefs <Object[]> Array of object literal Column definitions for the master table.
masterDataSource <YAHOO.util.DataSource> DataSource instance for the master table.
nestedColDefs <Object[]> Array of object literal Column definitions for the nested tables.
nestedDataSource <YAHOO.util.DataSource> DataSource instance for the nested tables.
masterOptions <object> (optional) Object literal of configuration values for the master table.
nestedOptions <object> (optional) Object literal of configuration values for the nested tables.

Methods

_checkPositions

private void _checkPositions ( )
Checks the vertical positions of all the expanded nested tables whenever the master table has been re-arranged
Returns: void

_destroyNested

private void _destroyNested ( detail.div , detail.dt , detail.expanded , detail.td , detail.tdNewHeight , detail.tdOldHeight )
Destroys a nested table
Parameters:
detail.div <HTMLElement> The DIV element containing the nested table instance.
detail.dt <YAHOO.widget.DataTable> The nested DataTable instance.
detail.expanded <Boolean> Whether the master record is expanded and the nested table visible
detail.td <HTMLElement> The toggle cell in the row of the master table
detail.tdNewHeight <Integer> The height, in pixels, needed for the row in the master record to hold the nested DataTable.
detail.tdOldHeight <Integer> The original height, in pixels, of the row in the master record before it was expanded.
Returns: void

_forAllNested

private void _forAllNested ( fn )
Loops through all the records and calls the given function on all those that have nested tables. The function will receive:
  • detail: details of the nested table (same as provided for all events)
  • record: reference to the Record object in the master table
Parameters:
fn <function> The function to be called on each nested tableelement to format with markup.
Returns: void

_makeNestedTable

private void _makeNestedTable ( record )
Makes each of the nested tables
Parameters:
record <YAHOO.widget.Record> the Record instance of the master table
Returns: void

_onEventToggleNested

private void _onEventToggleNested ( oArgs.event , oArgs.target )
Expands or collapses the nested table. It is preset as the event listener for the cellClickEvent and responds only on the toggle column
Parameters:
oArgs.event <HTMLEvent> Event object.
oArgs.target <HTMLElement> Target element.
Returns: void

_onMasterRendered

private void _onMasterRendered ( )
Event listener for the renderEvent on the master table. When the master is rendered, the nested tables have to be repositioned
Returns: void

_onRowDeleteDestroyNested

private void _onRowDeleteDestroyNested ( oArgs.oldData , oArgs.recordIndex , oArgs.trElIndex )
Event listener for the rowDeleteEvent event. Destroys the nested table, if any.
Parameters:
oArgs.oldData <Object> Object literal of the deleted data.
oArgs.recordIndex <Number> Index of the deleted Record.
oArgs.trElIndex <Number> Index of the deleted TR element, if on current page.
Returns: void

_onRowsDeleteDestroyNested

private void _onRowsDeleteDestroyNested ( oArgs.oldData , oArgs.recordIndex , oArgs.count )
Event listener for the rowsDeleteEvent event. Destroys the nested tables, if any.
Parameters:
oArgs.oldData <Object[]> Array of object literals of the deleted data.
oArgs.recordIndex <Number> Index of the first deleted Record.
oArgs.count <Number> Number of deleted Records.
Returns: void

_onWindowResized

private void _onWindowResized ( ev )
Event listener for the window.resize event. Repositions the nested tables since the master table might have been moved around
Parameters:
ev <DOMEvent> the Event object from the DOM
Returns: void

_toggleFormatter

private void _toggleFormatter ( el , oRecord , oColumn , oData )
Formats the toggle cell. It is a standard cell formatter but is not made public since it is tied to the toggle column and is useless in any other context
Parameters:
el <HTMLElement> The element to format with markup.
oRecord <YAHOO.widget.Record> Record instance.
oColumn <YAHOO.widget.Column> Column instance.
oData <Object> (Optional) Data value for the cell.
Returns: void

initializeTable

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

onDataReturnSetRows

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

Events

beforeGenerateNestedRequestChange

beforeGenerateNestedRequestChange ( event )
Fires before the value for the configuration attribute 'generateNestedRequest' 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.

generateNestedRequestChange

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

nestedCreateEvent

nestedCreateEvent ( oArgs.div , oArgs.dt , oArgs.expanded , oArgs.td , oArgs.tdNewHeight , oArgs.tdOldHeight )
Fired when a nested table has been created.
Parameters:
oArgs.div <HTMLElement> The DIV element containing the nested table instance.
oArgs.dt <YAHOO.widget.DataTable> The nested DataTable instance.
oArgs.expanded <Boolean> Whether the master record is expanded and the nested table visible
oArgs.td <HTMLElement> The toggle cell in the row of the master table
oArgs.tdNewHeight <Integer> The height, in pixels, needed for the row in the master record to hold the nested DataTable.
oArgs.tdOldHeight <Integer> The original height, in pixels, of the row in the master record before it was expanded.

nestedDestroyEvent

nestedDestroyEvent ( oArgs.div , oArgs.dt , oArgs.expanded , oArgs.td , oArgs.tdNewHeight , oArgs.tdOldHeight )
Fired when a nested table is about to be destroyed.
Parameters:
oArgs.div <HTMLElement> The DIV element containing the nested table instance.
oArgs.dt <YAHOO.widget.DataTable> The nested DataTable instance.
oArgs.expanded <Boolean> Whether the master record is expanded and the nested table visible
oArgs.td <HTMLElement> The toggle cell in the row of the master table
oArgs.tdNewHeight <Integer> The height, in pixels, needed for the row in the master record to hold the nested DataTable.
oArgs.tdOldHeight <Integer> The original height, in pixels, of the row in the master record before it was expanded.

nestedMovedEvent

nestedMovedEvent ( oArgs.div , oArgs.dt , oArgs.expanded , oArgs.td , oArgs.tdNewHeight , oArgs.tdOldHeight )
Fired when a nested table has been moved.
Parameters:
oArgs.div <HTMLElement> The DIV element containing the nested table instance.
oArgs.dt <YAHOO.widget.DataTable> The nested DataTable instance.
oArgs.expanded <Boolean> Whether the master record is expanded and the nested table visible
oArgs.td <HTMLElement> The toggle cell in the row of the master table
oArgs.tdNewHeight <Integer> The height, in pixels, needed for the row in the master record to hold the nested DataTable.
oArgs.tdOldHeight <Integer> The original height, in pixels, of the row in the master record before it was expanded.

nestedToggleEvent

nestedToggleEvent ( oArgs.div , oArgs.dt , oArgs.expanded , oArgs.td , oArgs.tdNewHeight , oArgs.tdOldHeight )
Fired when the row in the master table has been expanded or collapsed.
Parameters:
oArgs.div <HTMLElement> The DIV element containing the nested table instance.
oArgs.dt <YAHOO.widget.DataTable> The nested DataTable instance.
oArgs.expanded <Boolean> Whether the master record is expanded and the nested table visible
oArgs.td <HTMLElement> The toggle cell in the row of the master table
oArgs.tdNewHeight <Integer> The height, in pixels, needed for the row in the master record to hold the nested DataTable.
oArgs.tdOldHeight <Integer> The original height, in pixels, of the row in the master record before it was expanded.

Configuration Attributes

generateNestedRequest - function

A function that receives a reference to the record in the master table being expanded and should return a value that will be used as the initialRequest configuration attribute for the nested DataTable for this record. The value returned varies depending on the type of DataSource used.
Default Value: null


Copyright © 2010 Yahoo! Inc. All rights reserved.