Select to view content in your preferred language

Direction Widget Departure Time/reset()

444
1
Jump to solution
12-06-2021 10:10 AM
cruzianEngineer
New Contributor

Hey guys, I'm working with the the Direction Widget ( https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Directions.html ) which as the default reset() function that should reset the components. Source and Target field are cleared but the Travel Mode and Departure Time field does not reset when called.

I was able to get access to the selectedTravelMode via the ViewModel and set it to the default travelModes[0] after the reset function is called. But I don't seem to have a way to access the departure-time combobox via the viewmodel. Variable `_departuretime: "leave-now"` via the Description class ( https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Directions-DirectionsView... ) seems to hold the select value, but also no access.

cruzianEngineer_0-1638814011998.png

 

0 Kudos
1 Solution

Accepted Solutions
cruzianEngineer
New Contributor

This was my solution to reset the travel mode and departure-time

Spoiler
directionsWidget.viewModel.reset();
directionsWidget.viewModel.selectedTravelMode = directionsWidget.viewModel.travelModes[0];
 
const departTimeSelect = document.getElementsByClassName("esri-directions__departure-time-select esri-select");
departTimeSelect.item(0)['value'] = 'now';
 

View solution in original post

0 Kudos
1 Reply
cruzianEngineer
New Contributor

This was my solution to reset the travel mode and departure-time

Spoiler
directionsWidget.viewModel.reset();
directionsWidget.viewModel.selectedTravelMode = directionsWidget.viewModel.travelModes[0];
 
const departTimeSelect = document.getElementsByClassName("esri-directions__departure-time-select esri-select");
departTimeSelect.item(0)['value'] = 'now';
 
0 Kudos