Opened 14 years ago
Closed 11 years ago
#4672 closed feature (fixed)
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.
Change History (9)
comment:1 Changed 14 years ago by
Milestone: | TBD → 1.8 |
---|
comment:2 follow-up: 6 Changed 13 years ago by
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>"));
comment:3 Changed 13 years ago by
Milestone: | 1.9 → 1.next |
---|---|
Summary: | Adding items to an accordion → Accordion: ability to add/remove panels |
Type: | enhancement → feature |
comment:5 Changed 12 years ago by
Status: | new → open |
---|
comment:6 Changed 12 years ago by
@scott.gonzalez Unfortunately this code is a little buggy when we use sortable accordions :
- First, the added accordion is always placed at bottom of the existing accordions.
- 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/
comment:7 Changed 11 years ago by
Milestone: | 1.next → 1.10.0 |
---|---|
Version: | → 1.8 |
comment:9 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Accordion: Enhance refresh to allow adding/removing panels. Fixes #4672 - Accordion: ability to add/remove panels
Changeset: d657538ed57a96b610853d69e9fbf559c5ae230f
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.