Add help button link inside widgets

2762
25
05-04-2017 02:58 PM
CCWeedcontrol
Regular Contributor

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');
      },
0 Kudos
25 Replies
CCWeedcontrol
Regular Contributor

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.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Like I said I took your widget an added it to a new app and in the latest Chrome I had no issue.

0 Kudos
CCWeedcontrol
Regular Contributor

OK thanks for responses and help. I am lost as to why it doesn't work in Chrome or Internet explorer.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Try adding the widget to a new app and see if you get the same behavior.

0 Kudos
CCWeedcontrol
Regular Contributor

In Chrome if i am in developer tools the 'Help' button works but once i close out of Dev tools it stops working.

0 Kudos
Keith-Bornhorst
New Contributor III

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>

?

0 Kudos