My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for

AccordionTag  
Renders a accordion from a given list or map.
Phase-Implementation
Updated Jun 10, 2010 by johgep

Introduction

This Tag renders a accordion from a given list or an map

For custom themes for the Accordion take look at the Head Tag.

Samples

Fill List in Action

public class Test {

        private Map<String, String>        mylist;

        public String execute() {
                mylist = new HashMap<String, String>();
                mylist.put("Section 1", "Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.");
                mylist.put("Section 2", "Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.");
                mylist.put("Section 3", "Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.");
                mylist.put("Section 4", "Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.");

                return SUCCESS;
        }

        public Map<String, String> getMylist() {
                return mylist;
        }

Render Accordion

<sj:accordion list="mylist"/>

Open the Accordion on mouse over.

<sj:accordion list="mylist" openOnMouseover="true"/>

Accordion with AJAX Content

You can use the Attributes paramKeys and paramValues to append parameters to each URL.

    <s:url id="urlecho" action="echo"/>
    <sj:accordion 
    	list="accordion" 
    	listKey="title" 
    	listValue="content"
    	paramKeys="echo" 
    	paramValues="content" 
    	href="%{urlecho}" 
    	active="false" 
    	autoHeight="false" 
    	clearStyle="true" 
    	/>

Topics

Topic Event Parameter
onBeforeTopics changestart event.originalEvent.event, event.originalEvent.ui
onChangeTopics change event.originalEvent.event, event.originalEvent.ui

Attributes

Name

Required

Default

Evaluated

Type

Description

accesskey false false String Set the html accesskey attribute on rendered html element
active false false String Selector for the active element. Set to false to display none at start. Needs collapsible: true. Default: 0
animated false false String Choose your favorite animation, or disable them (set to false). Values are slide, bounceslide. Default: slide
autoHeight false true false Boolean If set, the highest content part is used as height reference for all other parts. Provides more consistent animations. Default: true
clearStyle false false false Boolean If set, clears height and overflow styles after finishing animations. This enables accordions to work with dynamic content. Won't work together with autoHeight. Default: false
collapsible false false false Boolean Whether all the sections can be closed at once. Allows collapsing the active section by the triggering event. Default: false
cssClass false false String The css class to use for element
cssErrorClass false false String The css error class to use for element
cssErrorStyle false false String The css error style definitions for element to use
cssStyle false false String The css style definitions for element to use
disabled false false String Set the html disabled attribute on rendered html element
fillSpace false false false Boolean If set, the accordion completely fills the height of the parent element. Overrides autoheight.. Default: false
header false h3 false String Selector for the header element. Default: h3
href false false String The URL to call to obtain the content. Note: If used with ajax context, the value must be set as an url tag value.
id false false String HTML id attribute
javascriptTooltip false false false Boolean Use JavaScript to generate tooltips
key false false String Set the key (name, value, label) for this particular component
label false false String Label expression used for rendering an element specific label
labelSeparator false : false String String that will be appended to the label
labelposition false false String Define label position of form element (top/left)
list false false String Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.
listKey false false String Property of list objects to get field value from
listValue false false String Property of list objects to get field content from
name false false String The name to set for element
onAlwaysTopics false false String A comma delimited list of topics that published always
onBeforeTopics false false String Topics that are published before a load
onBlurTopics false false String A comma delimited list of topics that published when the element is blured
onChangeTopics false false String A comma delimited list of topics that published when the element changed
onCompleteTopics false false String A comma delimited list of topics that published when the element ajax request is completed (will override settings for a target container if provided)
onDisableTopics false false String A comma delimited list of topics that published when the element disabled
onEnableTopics false false String A comma delimited list of topics that published when the element is enabled
onErrorTopics false false String A comma delimited list of topics that published when the element ajax request returns an error (will override settings for a target container if provided)
onFocusTopics false false String A comma delimited list of topics that published when the element is focused
onSuccessTopics false false String A comma delimited list of topics that published when the element ajax request is completed successfully (will override settings for a target container if provided)
onblur false false String Set the html onblur attribute on rendered html element
onchange false false String Set the html onchange attribute on rendered html element
onclick false false String Set the html onclick attribute on rendered html element
ondblclick false false String Set the html ondblclick attribute on rendered html element
onfocus false false String Set the html onfocus attribute on rendered html element
onkeydown false false String Set the html onkeydown attribute on rendered html element
onkeypress false false String Set the html onkeypress attribute on rendered html element
onkeyup false false String Set the html onkeyup attribute on rendered html element
onmousedown false false String Set the html onmousedown attribute on rendered html element
onmousemove false false String Set the html onmousemove attribute on rendered html element
onmouseout false false String Set the html onmouseout attribute on rendered html element
onmouseover false false String Set the html onmouseover attribute on rendered html element
onmouseup false false String Set the html onmouseup attribute on rendered html element
onselect false false String Set the html onselect attribute on rendered html element
openOnMouseover false false false Boolean open accordion on mouse over event. Default: false
openTemplate false false String Set template to use for opening the rendered html.
paramKeys false false String Comma seperated List of parameter names for the href url. e.g. queryParam1,queryParam2
paramValues false false String Comma seperated List of List Keys for parameter values. e.g. queryValue1,queryValue2
required false false false Boolean If set to true, the rendered element will indicate that input is required
requiredposition false false String Define required position of required form element (left|right)
tabindex false false String Set the html tabindex attribute on rendered html element
template false false String The template (other than default) to use for rendering the element
templateDir false false String The template directory.
title false false String Set the html title attribute on rendered html element
tooltip false false String Set the tooltip of this particular component
tooltipConfig false false String Deprecated. Use individual tooltip configuration attributes instead.
tooltipCssClass false StrutsTTClassic false String CSS class applied to JavaScrip tooltips
tooltipDelay false Classic false String Delay in milliseconds, before showing JavaScript tooltips
tooltipIconPath false false String Icon path used for image that will have the tooltip
value false false String Preset the value of input element.
Comment by chaminda...@gmail.com, Oct 28, 2009

is there any way to call .jsp file to accordion.......

Comment by project member johgep, Oct 28, 2009

Do you mean with ajax? In the Showcase you find an Example with remote content.

Comment by vinicius...@gmail.com, Jun 1, 2010

I need return a remote content from action some HTML tag's. But when I try, those tags are printed on page. Anyone know how I return html tags form remote content?

Comment by project member johgep, Jun 1, 2010

maybe your output was encoded?

Please use for questions the UserGroup?. http://groups.google.com/group/struts2-jquery

Comment by dimonb...@gmail.com, Feb 3, 2011

After upgrading to 2.5.1 version error: The error is: Error: 'this.toHide.parent().0' is null or not an object Seems like problem with jQuery UI 1.8.8: http://bugs.jqueryui.com/ticket/6856


Sign in to add a comment
Powered by Google Project Hosting