What is the best way to programmatically open a panel inside a Dijit AccordionContainer

I am trying to open and close the accordion panels programmatically. Here is a simplified version of my code. Despite the fact that I set the first panel to be false, and the second panel to true, only the first panel opens when it loads in 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;
+3
source share
1 answer

You can do it as follows:

accordionContainer.selectChild( accordPane2 );

Assuming you are using dojo 1.3.

dijit.layout.AccordionContaineris a subclass dijit.layout.StackContainerthat has selectChild.

I set up a demo page where you can see this code in action

selectChild startup, , , "". (, , )

+10

Source: https://habr.com/ru/post/1713688/


All Articles