Directions widget, multiple preset stops?

1105
4
Jump to solution
03-26-2018 01:10 PM
RobertLackage
New Contributor III

Is it possible to add more preset stops then just the start and end points in the directions widget? I'd like to have preset directions for multiple points.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Robert,

  In the Widget.js file make this change to the _onDirectionsActivate function:

      _onDirectionsActivate: function () {
        if (this.config.defaultLocations &&
          this.config.defaultLocations.length && this.config.defaultLocations.length > 0 &&
          false === this._isInitPresetStopsFlag) {

          this._isInitPresetStopsFlag = true;
          this._dijitDirections.addStops(this.config.defaultLocations);
          this._dijitDirections.addStop();
          this._dijitDirections.addStop();
          this._dijitDirections.addStop();
          this._dijitDirections.addStop();
        }
      },

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Robert,

   are you asking for the directions widget to open with more then the 2 default stops? If so how many?

0 Kudos
RobertLackage
New Contributor III

Yes, I'd like 6 default stops to be preset.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Robert,

  In the Widget.js file make this change to the _onDirectionsActivate function:

      _onDirectionsActivate: function () {
        if (this.config.defaultLocations &&
          this.config.defaultLocations.length && this.config.defaultLocations.length > 0 &&
          false === this._isInitPresetStopsFlag) {

          this._isInitPresetStopsFlag = true;
          this._dijitDirections.addStops(this.config.defaultLocations);
          this._dijitDirections.addStop();
          this._dijitDirections.addStop();
          this._dijitDirections.addStop();
          this._dijitDirections.addStop();
        }
      },
RobertLackage
New Contributor III

Thanks Robert! Your eSearch is the best btw.