I'm adding a checkbox on my widget that turns labels on or off on a particular layer. However, it doesn't respond to the click event "showCoinLabels" as defined in data-dojo-attach-event
<div data-dojo-type="jimu/dijit/CheckBox" data-dojo-attach-point="chkCoinLabels" style="margin-top: 5px;" data-dojo-attach-event="onClick: showCoinLabels"></div><label class="jimu-leading-margin05">Show Coin Labels</label>
If I substitute a jimu-btn, that will fire the event
<div data-dojo-attach-point="btntest" id="chkCoinLabels" class="jimu-btn apply" data-dojo-attach-event="onclick:showCoinLabels" style="margin-top: 10px">Show Coin Labels</div>
I've also tried using a regular data-dojo-type="dijit/form/CheckBox", as used in the Analysis widget Setting.html, with no luck. What's the proper way to add a checkbox?
Solved! Go to Solution.
Ken,
The jimu/dijit/CheckBox does not have an onClick event. Here is what I use:
//in your Widget.js
this.chkCoinLabels.onChange = lang.hitch(this, this.showCoinLabels);
Ken,
The jimu/dijit/CheckBox does not have an onClick event. Here is what I use:
//in your Widget.js
this.chkCoinLabels.onChange = lang.hitch(this, this.showCoinLabels);
Thanks, Rob. That explains why some widgets use jimu/dijit/CheckBox and others use dijit/form/CheckBox. I shouldn't have assumed they had the same capabilities.