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 comment:1
milestone: | TBD → 1.8 |
---|
Changed June 23, 2010 07:09PM UTC by 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 comment:3
milestone: | 1.9 → 1.next |
---|---|
summary: | Adding items to an accordion → Accordion: ability to add/remove panels |
type: | enhancement → feature |
Changed July 14, 2010 04:57PM UTC by comment:4
Add a refresh-method, similar to menu (unlike tabs, thats fine).
Changed March 28, 2011 08:54PM UTC by comment:5
status: | new → open |
---|
Changed April 23, 2011 07:12PM UTC by 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 comment:7
milestone: | 1.next → 1.10.0 |
---|---|
version: | → 1.8 |
Changed October 31, 2012 02:53PM UTC by comment:8
Pull request: https://github.com/jquery/jquery-ui/pull/793
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.