Properties Methods Events Config Options Direct Link

    ContainerLayout
      FitLayout
        Accordion

# Class Ext.layout.Accordion

Package: | Ext.layout
Defined In: | AccordionLayout.js
Class: | Accordion
Extends: | FitLayout

This is a layout that contains multiple panels in an expandable accordion style such that only one panel can be open at any given time. Each panel has built-in support for expanding and collapsing. This class is intended to be extended or created via the layout:'accordion' Ext.Container.layout config, and should generally not need to be created directly via the new keyword.

Note that when creating a layout via config, the layout-specific config properties must be passed in via the Ext.Container.layoutConfig object which will then be applied internally to the layout. Example usage:

    var accordion = new Ext.Panel({
        title: 'Accordion Layout',
        layout:'accordion',
        defaults: {
            // applied to each contained panel
            bodyStyle: 'padding:15px'
        },
        layoutConfig: {
            // layout-specific configs go here
            titleCollapse: false,
            animate: true,
            activeOnTop: true
        },
        items: [{
            title: 'Panel 1',
            html: '<p>Panel content!</p>'
        },{
            title: 'Panel 2',
            html: '<p>Panel content!</p>'
        },{
            title: 'Panel 3',
            html: '<p>Panel content!</p>'
        }]
    });

## Config Options

Config Options | Defined By
--- | ---
| activeOnTop : Boolean True to swap the position of each panel as it is expanded so that it becomes the first item in the container, false t... True to swap the position of each panel as it is expanded so that it becomes the first item in the container, false to keep the panels in the rendered order. This is NOT compatible with "animate:true" (defaults to false). | Accordion
| animate : Boolean True to slide the contained panels open and closed during expand/collapse using animation, false to open and close di... True to slide the contained panels open and closed during expand/collapse using animation, false to open and close directly with no animation (defaults to false). Note: to defer to the specific config setting of each contained panel for this property, set this to undefined at the layout level. | Accordion
| autoWidth : Boolean True to set each contained item's width to 'auto', false to use the item's current width (defaults to true). Note tha... True to set each contained item's width to 'auto', false to use the item's current width (defaults to true). Note that some components, in particular the grid, will not function properly within layouts if they have auto width, so in such cases this config should be set to false. | Accordion
| collapseFirst : Boolean True to make sure the collapse/expand toggle button always renders first (to the left of) any other tools in the cont... True to make sure the collapse/expand toggle button always renders first (to the left of) any other tools in the contained panels' title bars, false to render it last (defaults to false). | Accordion
| extraCls : String An optional extra CSS class that will be added to the container (defaults to ''). This can be useful for adding custo... An optional extra CSS class that will be added to the container (defaults to ''). This can be useful for adding customized styles to the container or any of its children using standard CSS rules. | ContainerLayout
| fill : Boolean True to adjust the active item's height to fill the available space in the container, false to use the item's current... True to adjust the active item's height to fill the available space in the container, false to use the item's current height, or auto height if not explicitly set (defaults to true). | Accordion
| hideCollapseTool : Boolean True to hide the contained panels' collapse/expand toggle buttons, false to display them (defaults to false). When se... True to hide the contained panels' collapse/expand toggle buttons, false to display them (defaults to false). When set to true, titleCollapse should be true also. | Accordion
| renderHidden : Boolean True to hide each contained item on render (defaults to false). | ContainerLayout
| sequence : Boolean Experimental. If animate is set to true, this will result in each animation running in sequence. | Accordion
| titleCollapse : Boolean True to allow expand/collapse of each contained panel by clicking anywhere on the title bar, false to allow expand/co... True to allow expand/collapse of each contained panel by clicking anywhere on the title bar, false to allow expand/collapse only when the toggle tool button is clicked (defaults to true). When set to false, hideCollapseTool should be false also. | Accordion

## Public Properties

Property | Defined By
--- | ---
| activeItem : Ext.Component A reference to the Ext.Component that is active. For example, if(myPanel.layout.activeItem.id == 'item-1') { ... }.... A reference to the Ext.Component that is active. For example, if(myPanel.layout.activeItem.id == 'item-1') { ... }. activeItem only applies to layout styles that can display items one at a time (like Ext.layout.Accordion, Ext.layout.CardLayout and Ext.layout.FitLayout). Read-only. Related to Ext.Container.activeItem. | ContainerLayout

## Public Methods

Method | Defined By
--- | ---
| setActiveItem( `String/Number item` ) : void Sets the active (expanded) item in the layout. Sets the active (expanded) item in the layout. Parameters: `item` : String/Number The string component id or numeric index of the item to activate Returns: `void` | Accordion

## Public Events

This class has no public events.