Not sure how complicated it is but i would like to add a 'Help' button onto some of the widgets i have on my application. I tried coping the 'Measure' widget code but i can't get to work. I would gratefully appreciate any help please.
I have added the help image to html with the following and can see the help icon inside the widget.
div data-dojo-type="jimu/dijit/LoadingShelter" data-dojo-attach-point="shelter" data-dojo-props="hidden:true"></div>
<br><br><br><br><br><br><br><br><br><br><br><br>
<img src="widgets/ElevationProfile/images/help.png" height="25" width="62" data-dojo-attach-point="helpImage" style="cursor:pointer" />
</div>
I added the function in the _blindEvents: Function like so.
_bindEvents: function () {
this.own(on(this.btnClear, 'click', lang.hitch(this, this._clear)));
html.setStyle(this.btnClear, 'display', 'none');
this.own(on(this.btnExport, 'click', lang.hitch(this, this._export)));
this.own(on(this.helpImage, 'click', lang.hitch(this, function() {
var win = window.open("widgets/ElevationProfile/help/index.html", "_blank");
win.focus();
})));
html.setStyle(this.btnExport, 'display', 'none');
html.setStyle(this.btnInfo, 'display', 'none');
html.setStyle(this.btnDownload, 'display', 'none');
},
Same results in Chrome incognito window. I have been doing a 'Empty cache and hard reload'.
It's on the new 'Help' button that has the issue.
Like I said I took your widget an added it to a new app and in the latest Chrome I had no issue.
OK thanks for responses and help. I am lost as to why it doesn't work in Chrome or Internet explorer.
Try adding the widget to a new app and see if you get the same behavior.
In Chrome if i am in developer tools the 'Help' button works but once i close out of Dev tools it stops working.
If you're already editing Widget.html and you don't need any special state or display logic, why not keep it all in HTML/JavaScript and wrap your image in a A tag with the necessary JavaScript to open up the new window?
<a href="widgets/ElevationProfile/help/index.html" target="_blank">
<img src="widgets/ElevationProfile/images/help.png" height="25" width="62" />
</a>
?