Select to view content in your preferred language

Travel Mode Error in Direction Widget WAB

749
1
Jump to solution
12-05-2017 02:48 AM
AlbertoLópez
Occasional Contributor

Hello;

 

I have developed a WAB application with the Direction widget. The route web service has 2 travel modes.

In the startupt function of the widget I set  the travel mode to one of them (not the default ) and initialize the Direction dijit:

….

….                                                              

var routeTask = new RouteTask(this.config.routeTaskUrl1);     

routeTask.getServiceDescription().then(lang.hitch(this, function (serviceInfo) {

                        

        travelModes=serviceInfo.supportedTravelModes;

        this._dijitDirections.routeParams.travelMode= travelModes[1];

                                                

}))

 this._dijitDirections = new Directions(options, directionContainer);

 this._dijitDirections.startup();

After the line:  this._dijitDirections.startup (); the property travelMode is correct because it has the value that I have previously assigned:  travelModes [1]. 

But when the calculation of the route starts, the travelMode property changes to the other travel mode (travelModes [0]) and the calculation is made with this other travel mode.

I can see it in the directionStart event with the debugging tools. 

Any suggestions about  how to make the calculation  with the travel mode that I configured at the start (this._dijitDirections.routeParams.travelMode = travelModes [1];).?

the combo always shows the travel mode that I do not want. 

Js api version 3.22 

Thank you very much.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Alberto,

   You need to use this._dijitDirections.setTravelMode(travelModes [1]);

https://developers.arcgis.com/javascript/3/jsapi/directions-amd.html#settravelmode 

View solution in original post

1 Reply
RobertScheitlin__GISP
MVP Emeritus

Alberto,

   You need to use this._dijitDirections.setTravelMode(travelModes [1]);

https://developers.arcgis.com/javascript/3/jsapi/directions-amd.html#settravelmode