AnsweredAssumed Answered

Navigation Buttons - Active Marker - AMD version

Question asked by amarsden on Feb 18, 2018
Latest reply on Feb 19, 2018 by amarsden


I'm slowly refactoring my legacy app into AMD style.  I have code to change the style of the navigation buttons


function toggleButtonIcon(tool) { //only the tools in the toolbar are dijit togglebuttons so can iterate thru them
registry.byId.byClass("dijit.form.ToggleButton").forEach(function (togbtn) {

if (togbtn == tool) {
togbtn.attr("checked", true);
} else {
togbtn.attr("checked", false);



and am having difficulty working out the AMD alternative form ByClass, as it seems to have changed - 


dijit/registry — The Dojo Toolkit - Reference Guide 

Note that for backwards compatibility, the dijit.registry global variable (as opposed to the dijit/registry module) includes array iterator methods (forEach, filter, byClass, map, every, and some). However, AMD code should not expect these functions to be available in the Object returned from require([“dijit/registry”]).


My ideal is that my code will need not much, if any, change for the v4 API when all the features I use are in it, so I don't really want to have anything that will break later.


Any help gratefully received!





edit  I have now got as far as 


function toggleButtonIcon(tool) { 
var domNodes= query('.dijitToggleButton', this.domNode);
var widget= registry.getEnclosingWidget(domNode);
if (domNode == tool.innerHTML) {
} else {


But the Dojo query is returning the node whilst I am getting the full object passed into the function.  My brain is tired and I can't work out how to compare the two ?  I'll investigate getting the id out of the node