Skip to main content

Search and Top Navigation

#4672 closed feature (fixed)

Opened July 12, 2009 08:24PM UTC

Closed November 12, 2012 02:42AM UTC

Accordion: ability to add/remove panels

Reported by: wichert Owned by:
Priority: major Milestone: 1.10.0
Component: ui.accordion Version: 1.8
Keywords: Cc:
Blocked by: Blocking:
Description

It would be practical to be able to add items to an accordion. Currently you have to destroy and recreate the accordion, which is not very convenient.

Attachments (0)
Change History (9)

Changed July 12, 2009 08:29PM UTC by scottgonzalez comment:1

milestone: TBD1.8

We should look into how this is currently handled in other plugins, like tabs, and how it could be handled in any other plugins where adding/removing items would be useful.

Changed June 23, 2010 07:09PM UTC by mrfr0g comment:2

I needed this functionality for a project I'm working on, so I extended the base widget. I'm sure that this could be done more efficiently/better, but it works for my purposes.

New Method: add(el)

Parameter Type: jQuery object, or HTML Collection

New Option: autoActivate - Boolean - Set to true to auto activate the newly added node

http://www.e-d20.com/jquery/ui/jquery.ui.accordion.custom.js

Requirements: jquery-1.4.2, jquery-ui-1.8.2

Installation: Include the jquery.ui.accordion.custom.js in your page, after you have included jquery.ui.

Usage:

$("#accordion").accordion({

autoActivate: true

})

.accordion("add", $("<h3>New Node</h3><div><p>Content</p></div>"));

Changed July 12, 2010 01:41PM UTC by scottgonzalez comment:3

milestone: 1.91.next
summary: Adding items to an accordionAccordion: ability to add/remove panels
type: enhancementfeature

Changed July 14, 2010 04:57PM UTC by jzaefferer comment:4

Add a refresh-method, similar to menu (unlike tabs, thats fine).

Changed March 28, 2011 08:54PM UTC by scottgonzalez comment:5

status: newopen

Changed April 23, 2011 07:12PM UTC by TheDoci comment:6

_comment0: Unfortunately this code is a little buggy when we use sortable accordions : \ 1. First, the added accordion is always placed at bottom of the existing accordions. \ 2. Then, after some sortings in the accordion's list, it bugs : it selects 2 or more accordions when sorting them, and we cannot place an element on top.1303585975425159
_comment1: @scott.gonzalez \ Unfortunately this code is a little buggy when we use sortable accordions : \ 1. First, the added accordion is always placed at bottom of the existing accordions. \ 2. Then, after some sortings in the accordion's list, it bugs : it selects 2 or more accordions when sorting them, and we cannot place an element on top.1303587713318057

@scott.gonzalez

Unfortunately this code is a little buggy when we use sortable accordions :

1. First, the added accordion is always placed at bottom of the existing accordions.

2. Then, after some sortings in the accordion's list, it bugs : it selects 2 or more accordions when sorting them, and we cannot place an element on top.

You can find a demo here : http://jsfiddle.net/a6rCu/

Changed October 03, 2012 03:44PM UTC by scottgonzalez comment:7

milestone: 1.next1.10.0
version: → 1.8

Changed October 31, 2012 02:53PM UTC by petersendidit comment:8

Changed November 12, 2012 02:42AM UTC by David Petersen comment:9

resolution: → fixed
status: openclosed

Accordion: Enhance refresh to allow adding/removing panels. Fixes #4672 - Accordion: ability to add/remove panels

Changeset: d657538ed57a96b610853d69e9fbf559c5ae230f