Like StackContainer and TabContainer, an AccordionContainer holds a set of panes whose titles are all visible, but only one pane's content is visible at a time. Clicking on a pane title slides the currently-displayed one away, similar to a garage door.
For this example, we'll show the lazy-loading feature of panes. Lazy loading defers the loading process until the pane is actually displayed. Since Dojo does this with XHR, you can only load panes that reside on the server from which the original content came. We'll use a test pane provided with Dijit. You can download this file from the nightly build at http://svn.dojotoolkit.org/dojo/dijit/trunk/tests/layout/tab1.html. For the example to work verbatim, just place it in the same directory as this file on your web server.
|
dijit.layout.AccordionContainer
Holds a set of AccordionPane widgets and displays the title of every pane, but only one pane is visible at a time. Switching between panes is visualized by sliding the other panes up/down.
|
||
|
Attributes
|
||
| duration | Integer 250 |
Amount of time (in ms) it takes for panes to slide |
|
Methods
|
||
| addChild(/*Widget*/ child, /*Integer?*/ insertIndex) | Process the given child widget, inserting its dom node as a child of our dom node | |
| back() | New for 1.0Select previous page. | |
| closeChild(/*Widget*/ page) | Close the given widget, like clicking the X button | |
| forward() | New for 1.0Select next page. | |
| Widget[] getChildren() | returns array of children widgets | |
| Widget getNextSibling() | returns the widget "to the right" | |
| Widget getParent() | returns the parent widget of this widget, assuming the parent implements dijit._Container | |
| Widget getPreviousSibling() | returns the widget "to the left" | |
| Boolean hasChildren() | true if this widget has child widgets | |
| removeChild(/*Widget*/ page) | removes the passed widget instance from this widget but does not destroy it | |
| resize(/* Object */ args) | Explicitly set this widget size (in pixels), and then call layout() to resize contents (and maybe adjust child widgets). Args is of form {w: int, h: int, l: int, t: int}. | |
| selectChild(/*Widget*/ page) | Show the given widget (which must be one of my children) | |
|
dijit.layout.AccordionPane
AccordionPane is a ContentPane with a title. Indirect loading with the href property is supported. Nested Dijit layout widgets inside AccordionPane, such as SplitContainer, are not supported at this time.
|
| Action | Key |
|---|---|
| Navigate to next title | Right or down arrow |
| Navigate to previous title | Left or up arrow |
| Navigate into page | Tab |
| Navigate to next page | Ctrl + page down, ctrl + tab (except IE7) |
| Navigate to previous page | Ctrl + page up |