AccordionView YUI Widget

accordionview 

AccordionView YUI Widget > accordionview > YAHOO.widget.AccordionView

Class YAHOO.widget.AccordionView - extends YAHOO.util.Element

A widget to control accordion views.

Constructor

YAHOO.widget.AccordionView ( el , oAttr )
Parameters:
el <HTMLElement | String> The id of the html element that represents the AccordionView.
oAttr <Object> (optional) A key map of the AccordionView's initial oAttributes.

Properties

_ARIACapable - private Boolean

Whether we're ARIA capable (currently only IE8 ad FF3)

_closing - private Boolean

Keeps track of whether a panel is currently in the process of closing. Used to time when a full change is finished (open and close panel)

_ff2 - private Boolean

Whether we're running FF2 or older (or another derivate of Gecko < 1.9)

_hoverTimer - private object

Holds the timer for hover activated accordions

_idCounter - private Integer

Internal counter to make sure id's are unique

_ie - private Boolean

Whether we're running IE6 or IE7

_opening - private Boolean

Keeps track of whether a panel is currently in the process of opening. Used to time when a full change is finished (open and close panel)

_panels - private Array

Holds references to all accordion panels (list elements) in an array

CLASSES - Object

Configuration object containing classes used in the AccordionView component. See sourcecode for explanation in case you need to change this

CONFIG - Object

Configuration object containing tag names used in the AccordionView component. See sourcecode for explanation in case you need to change this

Methods

_collapseAccordion

private void _collapseAccordion ( )
Closes all panels
Returns: void

_fixTabIndexes

private void _fixTabIndexes ( )
Set tabIndex to 0 on the first item in case all panels are closed or active. Otherwise set it to -1
Returns: void

_onClick

private void _onClick ( arg )
Global event handler for mouse clicks This method can accept both an event and a node so it can be called internally if needed
Parameters:
arg <HTMLElement|Event> The Dom event or event target
Returns: void

_onKeydown

private void _onKeydown ( ev )
Keyboard event handler for keyboard control of the widget
Parameters:
ev <Event> The Dom event
Returns: void

_onMouseOut

private void _onMouseOut ( ev )
Mouseout event handler Cancels the timer set by AccordionView::_onMouseOver
Parameters:
ev <Event> The Dom event
Returns: void

_onMouseOver

private void _onMouseOver ( ev )
Mouseover event handler
Parameters:
ev <Event> The Dom event
Returns: void

_setARIA

private void _setARIA ( el , sAttr , sValue )
Wrapper around setAttribute to make sure we only set ARIA roles and states in browsers that support it
Parameters:
el <HTMLElement> the element to set the attribute on
sAttr <String> the attribute name
sValue <String> the value for the attribute
Returns: void

addPanel

void addPanel ( oAttr , nIndex )
Adds an Accordion panel to the AccordionView instance. If no index is specified, the panel is added to the end of the tab list.
Parameters:
oAttr <Object> A key map of the Panel's properties
nIndex <Integer> The position to add the tab.
Returns: void

addPanels

void addPanels ( oPanels )
Wrapper around addPanel to add multiple panels in one call
Parameters:
oPanels <Array> array holding all individual panel configs
Returns: void

closePanel

Boolean closePanel ( nIndex )
Close a panel
Parameters:
nIndex <Integer> The position of the Panel.
Returns: Boolean
whether action resulted in closing a panel or not that was previously open This method honors all constraints imposed by the properties collapsible and expandable and will return false if the panel can't be closed because of a constraint in addition to if it was already closed

getPanel

HTMLElement getPanel ( nIndex )
Returns the HTMLElement of the panel at the specified index.
Parameters:
nIndex <Integer> The position of the Panel.
Returns: HTMLElement
the requested panel element

getPanels

Array getPanels ( )
Returns the Array containing all panels
Returns: Array
An array with references to the panels in the correct order

initAttributes

void initAttributes ( oAttr )
Initialize attributes for the Accordion
Parameters:
oAttr <Object> attributes key map
Returns: void

initEvents

void initEvents ( )
Attach all event listeners
Returns: void

initList

void initList ( el , oAttr )
Initialize the list / accordion
Parameters:
el <HTMLElement> The element for the accordion
oAttr <Object> attributes key map
Returns: void

openPanel

Boolean openPanel ( nIndex )
Open a panel
Parameters:
nIndex <Integer> The position of the Panel.
Returns: Boolean
whether action resulted in opening a panel that was previously closed

removePanel

void removePanel ( index )
Removes the specified Panel from the AccordionView.
Parameters:
index <Integer> of the panel to be removed
Returns: void

toString

String toString ( )
Provides a readable name for the AccordionView instance.
Returns: String
String representation of the object

Events

afterPanelClose

afterPanelClose ( )
Fires after a panel has finished closing. See Element.addListener for more information on listening for this event.

afterPanelOpen

afterPanelOpen ( )
Fires after a panel has finished opening. See Element.addListener for more information on listening for this event.

beforeStateChange

beforeStateChange ( )
Fires before a state change. This is useful to cancel an entire change operation See Element.addListener for more information on listening for this event.

panelClose

panelClose ( )
Fires before a panel closes. See Element.addListener for more information on listening for this event.

panelOpen

panelOpen ( )
Fires before a panel opens. See Element.addListener for more information on listening for this event.

stateChanged

stateChanged ( )
Fires after the accordion has fully changed state (after opening and/or closing (a) panel(s)). See Element.addListener for more information on listening for this event.


Copyright © 2008 Marco van Hylckama Vlieg All rights reserved.