Domanda

I have multiple title panes:

<div class="classname" data-dojo-props="title: 'Title Here', open: false" data-dojo-type="dijit.TitlePane">..</div>

Right now I have written this

<a onclick="dojo.forEach(dijit.registry.toArray(), function(item){  if (item.get('declaredClass')=='dijit.TitlePane'){item.set('open',true)};});">Expand All </a>
<a onclick="dojo.forEach(dijit.registry.toArray(), function(item){  if (item.get('declaredClass')=='dijit.TitlePane'){item.set('open',false)};});">Collapse All</a>

this successfully opens and closes all the title panes, but there is another title pane used in the page that I don't want affected by this. I tried using dojo.query('.classname').attr('open',false); but that didn't work.

I'm not experienced with dojo/dijits, how can I set open to true or false based on a class attribute? Any help would be greatly appreciated.

È stato utile?

Soluzione

You need the widget to do this not the dom object, and that is what query is giving you the dom object.

dojo.query('.classname').forEach(function(node){
     dijit.getEnclosingWidget(node).set('open',false); 

})
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top