Question

To get the details of child (of accordian container) that the user is clicking on, I subscribed to this topic - "-selectChild". Working fine, but later I wanted to keep all the content panes collapsed by default inside a accordian container, I searched on the internet, couldn't find it, but tried it by calling selectChild(0) on accordian container. It worked but after adding this line (selectChild(0)), I am getting error when user clicks on any pane

Error that I am getting:

Uncaught TypeError: Cannot read property 'containerNode' of undefined

Code(not complete code)

topic.subscribe("accordianContainerId-selectChild", function(pane){
console.log('user selected pane:'+pane)
});


aContainer = new AccordionContainer({id: 'accordianContainerId', "isLayoutContainer": true,style:"height: 100%"});
aContainer.addChild(new ContentPane({ 
            id: 'test',
            title: 'test',
            content: "<div>test</div>", doLayout: true
            }));
aContainer.placeAt("markup");
aContainer.startup();
aContainer.selectChild(0);
Was it helpful?

Solution

you need pass a child pane widget to selectChild instead of a number. You are doing a trick to achieve "no pane being selected", but accordionContainer will keep your current selected pane so next time it can collapse this pane while you select another pane. Now, of course, for you current selected pane "0", it is actually an undefined pane, no containerNode property.

You can't collapse all panes for a AccordionContainer, you can try use TitleGroup instead,

see dojox.widget.TitleGroup

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top