Alberto,
I have not tested this but this should work in theory (added lines 64 thru 69 in the Widget.js):
startup: function(){
this.inherited(arguments);
this.portal = portalUtils.getPortal(this.appConfig.portalUrl);
this._preProcessConfig().then(lang.hitch(this, function(){
var routeParams = new RouteParameters();
var routeOptions = this.config.routeOptions;
if(routeOptions){
if(routeOptions.directionsLanguage){
routeParams.directionsLanguage = routeOptions.directionsLanguage;
}
else{
routeParams.directionsLanguage = dojoConfig.locale || "en_us";
}
routeParams.directionsLengthUnits = routeOptions.directionsLengthUnits;
routeParams.directionsOutputType = routeOptions.directionsOutputType;
if(routeOptions.impedanceAttribute){
routeParams.impedanceAttribute = routeOptions.impedanceAttribute;
}
}
var options = {
map: this.map,
searchOptions: this.config.searchOptions,
routeParams: routeParams,
routeTaskUrl: this.config.routeTaskUrl,
dragging: true,
showClearButton: true,
mapClickActive: true
};
if(this.config.routeOptions && this.config.routeOptions.directionsLengthUnits) {
options.directionsLengthUnits = this.config.routeOptions.directionsLengthUnits;
}
if(this.config.trafficLayerUrl){
this._trafficLayer = new ArcGISDynamicMapServiceLayer(this.config.trafficLayerUrl);
options.trafficLayer = this._trafficLayer;
options.traffic = true;
}else{
options.traffic = false;
options.showTrafficOption = false;
}
this.setDoNotFetchTravelModes(options).then(lang.hitch(this, function() {
html.empty(this.directionController);
var directionContainer = html.create('div', {}, this.directionController);
esriRequest({
url: options.routeTaskUrl,
content: {
f: 'json'
},
handleAs: 'json',
callbackParamName: 'callback'
}).then(lang.hitch(this, function() {
this._dijitDirections = new Directions(options, directionContainer);
this._dijitDirections.startup();
console.info(this._dijitDirections);
this.own(on(this._dijitDirections, 'load', lang.hitch(this, this._onDirectionsActivate)));
this.own(on(this._dijitDirections._travelModeSelector, 'change', lang.hitch(this, function(evt){
this.config.routeTaskUrl = "ypur new url";
this.destroy();
this.startup();
})));
......
: