Select to view content in your preferred language

Enable My Location by default

2432
2
Jump to solution
01-14-2016 09:43 AM
JasonStanton__GISP
Regular Contributor

I am using the developer edition of WAB v1.3.  I'm looking for the ability to enable the My Location widget by default, rather than having to click on it.  Has anyone done this, or know if it's possible?  ESRI support said they couldn'e help me but suggested that "in the web app builder folder in \client\sitemap\widgets\MyLocation there is a widget.js file that controls the behavior of the widget. In this file at line 52 is where the startup behavior of the function occurs. This is where I beleive some custom code coulde be used to create the functionality you ".

Any suggestions??

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Jason,

  Sure the startup function would look like this (lines 9-11 added):

      startup: function() {
        this.inherited(arguments);
        this.placehoder = html.create('div', {
          'class': 'place-holder'
        }, this.domNode);

        if (window.navigator.geolocation) {
          this.own(on(this.placehoder, 'click', lang.hitch(this, this.onLocationClick)));
          this._createGeoLocate();
          this.geoLocate.locate();
          html.addClass(this.placehoder, "locating");
        } else {
          html.setAttr(this.placehoder, 'title', this.nls.browserError);
        }
      },

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Jason,

  Sure the startup function would look like this (lines 9-11 added):

      startup: function() {
        this.inherited(arguments);
        this.placehoder = html.create('div', {
          'class': 'place-holder'
        }, this.domNode);

        if (window.navigator.geolocation) {
          this.own(on(this.placehoder, 'click', lang.hitch(this, this.onLocationClick)));
          this._createGeoLocate();
          this.geoLocate.locate();
          html.addClass(this.placehoder, "locating");
        } else {
          html.setAttr(this.placehoder, 'title', this.nls.browserError);
        }
      },
JasonStanton__GISP
Regular Contributor

Thank you so much!  I wish you won Powerball!!