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
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)
Holds the timer for hover activated accordions
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
Configuration object containing classes used in the AccordionView component.
See sourcecode for explanation in case you need to change this
Configuration object containing tag names used in the AccordionView component.
See sourcecode for explanation in case you need to change this
Methods
private
void
_collapseAccordion
(
)
Closes all panels
private
void
_fixTabIndexes
(
)
Set tabIndex to 0 on the first item in case all panels are closed
or active. Otherwise set it to -1
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
private
void
_onKeydown
(
ev
)
Keyboard event handler for keyboard control of the widget
- Parameters:
-
ev <Event>
The Dom event
- Returns:
void
private
void
_onMouseOut
(
ev
)
Mouseout event handler
Cancels the timer set by AccordionView::_onMouseOver
- Parameters:
-
ev <Event>
The Dom event
- Returns:
void
private
void
_onMouseOver
(
ev
)
Mouseover event handler
- Parameters:
-
ev <Event>
The Dom event
- Returns:
void
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
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
void
addPanels
(
oPanels
)
Wrapper around addPanel to add multiple panels in one call
- Parameters:
-
oPanels <Array>
array holding all individual panel configs
- Returns:
void
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
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
Array
getPanels
(
)
Returns the Array containing all panels
- Returns:
Array
- An array with references to the panels in the correct order
void
initAttributes
(
oAttr
)
Initialize attributes for the Accordion
- Parameters:
-
oAttr <Object>
attributes key map
- Returns:
void
void
initEvents
(
)
Attach all event listeners
void
initList
(
el
,
oAttr
)
Initialize the list / accordion
- Parameters:
-
el <HTMLElement>
The element for the accordion
-
oAttr <Object>
attributes key map
- Returns:
void
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
void
removePanel
(
index
)
Removes the specified Panel from the AccordionView.
- Parameters:
-
index <Integer>
of the panel to be removed
- Returns:
void
String
toString
(
)
Provides a readable name for the AccordionView instance.
- Returns:
String
- String representation of the object
Events
afterPanelClose
(
)
Fires after a panel has finished closing.
See
Element.addListener
for more information on listening for this event.
afterPanelOpen
(
)
Fires after a panel has finished opening.
See
Element.addListener
for more information on listening for this event.
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
(
)
Fires before a panel closes.
See
Element.addListener
for more information on listening for this event.
panelOpen
(
)
Fires before a panel opens.
See
Element.addListener
for more information on listening for this event.
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.