How to determine which dijit.layout.AccordionPane is currently selected
-
26-09-2019 - |
Question
I tried to use "dijit.layout.AccordionPane.selected" to determine if any given AccordionPane is in focus (selected). However, AccordionPane.selected property will be set to "True" once the AccordionPane is selected, and AccordionPane.selected stays as "True" even other dijit.layout.AccordionPane is selected. So in other words, if I have 3 AccordionPanes, after I clicked on all 3 of them, AccordionPane.selected property for all 3 of them are "True" now. Is this a bug, or there is other ways to determine which AccordionPane is currently being selected (in focus)? Thanks in advance!
David
Solution
You should use the dijit.layout.AccordionContainer
that contains all these three dijit.layout.AccordionPane
to determine which one is currently selected.
You can use dijit.layout.AccordionContainer
's property selectedChildWidget
to get current selected dijit.layout.AccordionPane
.
OTHER TIPS
AccordionPane
s are wrapped within an AccordionContainer
. The AccordionContainer
extends StackContainer
which uses Dojo's pub-sub communication channel to advertise when a pane was selected. Subscribe to topic [widgetId]-selectChild
to get notified every time when a new pane is selected. [widgetId]
is the widget ID of the container element.
dojo.subscribe("[widgetId]-selectChild", function(pane){
console.log("A new pane was selected:", pane);
});