A few questions about accordions

(5 posts) (2 voices)

Tags:

No tags yet.

  1. adamhaeder, Member

    When I add multiple accordions to a page, I can only have one open at a time. Is there any way to allow a user to have multiple accordions open?

    And is there a way to have an accordion 'closed' by default?

    Thanks

  2. myDBR Team, Key Master

    Hi,
    The jQuery UI accordion that myDBR uses, is designed to keep only one panel open. If you really want to have panels to work independently, you could use dbr.javascript to issue a command found in here:

    http://stackoverflow.com/questions/15702444/jquery-ui-accordion-open-multiple-panels-at-once

    In order to call the jQuery accordion, you need to first destroy the one myDBR creates by issuing the command like this:

    $('.accordion').accordion('destroy').accordion({active:false,collapsible:true...

    The "active:false" option keeps the accordion 'closed' by default.

    --
    myDBR Team

  3. myDBR Team, Key Master

    An update on this one. The recent version (3.9.3 build 2069) includes possibility to pass jQuery accordion options as second parameter to dbr.accordion. We've also added a new option (multiopen) to allow opening multiple accordions at same time.

    To answer the original question having accordions closed by default and allowing multiple to be opened at same time, one can now use command:

    select 'dbr.accordion', 'My accordion', 'active:false,multiopen:true'; 

    --
    myDBR Team

  4. adamhaeder, Member

    Thanks, the multiopen works as expected. However, I have a few reports where I'd like to use accordions but I want them all to be open by default (but letting the user close them if they want to). I thought this would work:


    SELECT 'dbr.accordion', 'My accordion 1', 'multiopen:true';
    SELECT 'dbr.purehtml', CONCAT('Hello 1');
    SELECT 'dbr.accordion', 'My accordion 2', 'active:true';
    SELECT 'dbr.purehtml', CONCAT('Hello 2');
    SELECT 'dbr.accordion.close';

    but it doesn't, the first accordion is open but the 2nd is closed.

    I figured out that for the first accordion, if I have 'active:false' then it's closed by default, but 'active:true' still leaves it closed by default. I have to remove the 'active' option altogether to get it to be open by default. Then I don't have any way of indicating in subsequent accordions that they should be open by default as well, since 'active:true' doesn't do it. Apparently the jquery defaults to having the first accordion open and all others closed by default?

  5. myDBR Team, Key Master

    Hi,
    the newly added options can only be used in the first accordion as they are options for the whole accordion. The accordion by definiotion has only one section open. We added the option to have multiple open at once as the option to initially have them closed.

    To have them all opened, the easiest way for now is to have them closed by default and add following JavaScript to open them at load:

    select 'dbr.javascript', '$(".accordion_wrapper").find("h3 > a").click()', 'onload';

    The jQuery option 'active' has false (all closed) or a number of the section which will be initially opened (starting from zero). We'll take a look if we can have another option which would allow all sections to be open.

    --
    myDBR Team


Reply

You must log in to post.