Expander
Expander Panel
Expander Panel succeeds the earlier Table Panel, with more flexibility.
Page panels enclose an ACE Header and ACE Table, creating a pattern that can display a set of tables; with optional expand/collapse functionality. An ACE Lozenge is used to indicate the number of rows in the table.
Markup
Example | Comment | Code |
---|---|---|
By default, content will be expanded. |
Preset
Manual
|
|
To set the expander to collapsed, put the class on the outside and set the content's aria-hidden attribute to true .
|
Preset
Manual
|
|
To count visible ACE table rows, set the data-ace-counter-preset attribute to tableRows . Where both a preset and a custom counter are set, the custom counter will override the preset.
|
Preset
Manual
|
|
For a custom counter, set the data-ace-counter-selector attribute to a selector that identifies the elements you want to count. For the demonstration, will count the number of p elements.
|
Preset
Manual
|
|
To set the counter manually, ensure that no data-ace-counter-selector attribute has been set; and simply write the content of the lozenge.
|
Preset
Manual
|
|
To set a spot colour on the left-hand border, either set CSS via the ID or a custom class (recommended method); or set a style="border-color: #f00" attribute inline.
|
Using ID:
Inline:
Preset Inline
Manual Inline
Preset By ID
Manual By ID
|
Javascript
Methods
To initialise Expander Panels, use the init
method, eg:
$(document).ready(function(){
ACE.ExpanderPanel.init();
});
This will ensure all tables are hidden or shown according to the outer classname; and enables expand/collapse via click on the heading or counter.
Optional Methods
Function | Arguments | Description | Example |
---|---|---|---|
update | jQuery element or selector | Update the Expander Panel, in effect this will reset the count of visible table rows. |
|
toggle | jQuery element or selector | Toggle the table(s) matching the jQuery selector. If they are expanded, they will be collapsed; and vice versa. |
|
expand | jQuery element or selector | Expand the table(s) matching the jQuery selector. |
|
collapse | jQuery element or selector | Collapse the table(s) matching the jQuery selector. |
|
Events
Event | Description | Usage Example |
---|---|---|
ACE.ExpanderPanel.Updated | Fires when an Expander Panel has been updated. Passes an object with counterValue. For panels with no counter, the counterValue will be false .
|
|
ACE.ExpanderPanel.Toggled | Fires when an Expander Panel has been expanded or collapsed. Passes an object with the new state. |
|