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 Scott González

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.

comment:2 Changed 13 years ago by mrfr0g

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 Scott González

Milestone: 1.91.next
Summary: Adding items to an accordionAccordion: ability to add/remove panels
Type: enhancementfeature

comment:4 Changed 13 years ago by Jörn Zaefferer

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

comment:5 Changed 12 years ago by Scott González

Status: newopen

comment:6 in reply to:  2 Changed 12 years ago by TheDoci

@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/

Last edited 12 years ago by TheDoci (previous) (diff)

comment:7 Changed 11 years ago by Scott González

Milestone: 1.next1.10.0
Version: 1.8

comment:9 Changed 11 years ago by David Petersen

Resolution: fixed
Status: openclosed

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

Changeset: d657538ed57a96b610853d69e9fbf559c5ae230f

Note: See TracTickets for help on using tickets.