AnsweredAssumed Answered

passing an argument for click events, AMD style

Question asked by schlot on Oct 31, 2013
Latest reply on Oct 31, 2013 by BritishSteel
I have a button that used to work fine in my non-AMD syntax.  I have just two layers that I'd like to let the user turn on and off.  I had a small function that would check the current visibility and toggle it on/off depending on its current state.

    //functions for turning layer on/off       function toggleLayer(layerId) {       var layer = app.map.getLayer(layerId);       if (layer.visible) {           layer.hide();        } else {           layer.show();       }     } 


I had the button defined as
<button id="btnWICvendor" dojotype="dijit.form.Button" onClick="toggleLayer('venLayer')"> Click to Hide Sites</button>


From my reading, it sounded like I should be adding the click listener to the button using dojo/on.  Besides updating the button definition, I removed onClick and added this line into my code.  But it doesn't look like I pass any argument with this method. 
registry.byId('btnWICvendor').on('click', toggleLayer);


I thought this would be simple, but apparently not!  What am I missing?  I know I could use TOC, but that seems like overkill for this particular map.

Outcomes