TAccordion displays an accordion control. Users can click on the view headers to switch among
different accordion views. Each accordion view is an independent panel that can contain arbitrary content.
A TAccordion control consists of one or several {@link TAccordionView} controls representing the possible
accordion views. At any time, only one accordion view is visible (active), which is specified by any of
the following properties:
- {@link setActiveViewIndex ActiveViewIndex} - the zero-based integer index of the view in the view collection.
- {@link setActiveViewID ActiveViewID} - the text ID of the visible view.
- {@link setActiveView ActiveView} - the visible view instance.
If both {@link setActiveViewIndex ActiveViewIndex} and {@link setActiveViewID ActiveViewID}
are set, the latter takes precedence.
TAccordion uses CSS to specify the appearance of the accordion headers and panel. By default,
an embedded CSS file will be published which contains the default CSS for TTabPanel.
You may also use your own CSS file by specifying the {@link setCssUrl CssUrl} property.
The following properties specify the CSS classes used for elements in a TAccordion:
- {@link setCssClass CssClass} - the CSS class name for the outer-most div element (defaults to 'accordion');
- {@link setHeaderCssClass HeaderCssClass} - the CSS class name for nonactive accordion div elements (defaults to 'accordion-header');
- {@link setActiveHeaderCssClass ActiveHeaderCssClass} - the CSS class name for the active accordion div element (defaults to 'accordion-header-active');
- {@link setViewCssClass ViewCssClass} - the CSS class for the div element enclosing view content (defaults to 'accordion-view');
When the user clicks on a view header, the switch between the old visible view and the clicked one is animated.
You can use the {@link setAnimationDuration AnimationDuration} property to set the animation length in seconds;
it defaults to 1 second, and when set to 0 it will produce an immediate switch with no animation.
The TAccordion auto-sizes itself to the largest of all views, so it can encompass all of them without scrolling.
If you want to specify a fixed height (in pixels), use the {@link setViewHeight ViewHeight} property.
When a TAccordion is nested inside another, it's adviced to manually specify a {@link setViewHeight ViewHeight} for the internal TAccordion
To use TAccordion, write a template like following:
loadPostData()
публичный Метод
This method is primarly used by framework developers.
raisePostDataChangedEvent()
публичный Метод
This method is required by {@link \Prado\Web\UI\IPostBackDataHandler} interface.
It is invoked by the framework when {@link getActiveViewIndex ActiveViewIndex} property
is changed on postback.
This method is primarly used by framework developers.
renderContents()
публичный Метод
Renders body contents of the accordion control.