Add help button link inside widgets

2619
25
05-04-2017 02:58 PM
CCWeedcontrol
Occasional Contributor III

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
RobertScheitlin__GISP
MVP Emeritus

So what's not working? Does the image show up on the widget? Do you have widgets/ElevationProfile/images/help.png and a widgets/ElevationProfile/help/index.html in your app?

0 Kudos
CCWeedcontrol
Occasional Contributor III

My bad. The 'Help' image is in the Elevation Widget. when hover over the 'Help' mage on the widget my pointer does not turn into a pointing finger and if i click on it the 'Help' nothing happens. I do have the widgets/ElevationProfile/images/help.png and widgets/ElevationProfile/help/index.html in the app.

0 Kudos
CCWeedcontrol
Occasional Contributor III

I am still struggling on how to do this. Would really appreciate some help.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

So are you getting any errors in your browsers web console?

0 Kudos
CCWeedcontrol
Occasional Contributor III

I don't get any errors, it's as if when i click on the 'Help' button nothing happens at all, no click or anything.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

And you have code in your widget that calls _bindEvents right?

0 Kudos
CCWeedcontrol
Occasional Contributor III

I was testing it on the ElevationProfile widget so i do have the _bindEvent in the app\widgets\ElevationProfile\Widget.js. See attached.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

That image does not show me that you are actually calling that function though.

0 Kudos
CCWeedcontrol
Occasional Contributor III

oh well maybe that's my problem i thought i was. How call that function correctly?

0 Kudos