I am trying open & close accordion panes programatically. Here is the simplified version of my code. Even though I set the first pane's selected to false and and second pane's selected to true, only the first pane opens when it loads on the browser (FF3).
var accordionContainer = new dijit.layout.AccordionContainer().placeAt("test");
var accordPane = new dijit.layout.ContentPane({"title": "test", "content":"hello"});
var accordPane2 = new dijit.layout.ContentPane({"title": "test1", "content":"hello1"});
accordionContainer.addChild(accordPane);
accordionContainer.addChild(accordPane2, 1);
accordPane.startup();
accordPane2.startup();
//accordionContainer.selectChild(accordPane2);
accordionContainer.startup();
accordPane.selected = false;
accordPane2.selected = true;
-
You can do it like this:
accordionContainer.selectChild( accordPane2 );
Assuming you are using dojo 1.3.
dijit.layout.AccordionContainer
is a subclass ofdijit.layout.StackContainer
, which hasselectChild
defined.I set up a demo page where you can see this code in action
If you were calling
selectChild
beforestartup
, that could cause the error you were seeing since the widget wasn't in a 'complete' state. (Sorry, missed the commneted out code before I posted original answer)pacman : Thank you for responding. I am using dojo 1.3.2. I tried doing accordionContainer.selectChild( accordPane2 ); but it errored out. newWidget._buttonWidget is undefined According to the API doesn't look like selectChild is a function for AccordionContainer.seth : I've updated my answer in response.pacman : Thank you Seth. -
Hi All, Is it possible to minimize all the accordion panes initially. Can someone please let me know on how to do that?
pacman : Do NOT hijack other people's thread..pacman : And how is this an answer to OP's question?
0 comments:
Post a Comment