AnsweredAssumed Answered

How can I filter the travel modes displayed in the Directions widget?

Question asked by n.koehnesri-de-esridist Employee on May 19, 2016

I have an NAServer with several travel modes defined on the Network Dataset and I'm using that service in a JS app with the Directions widget. Enabling the showTravelModesOption shows the travel modes menu, and everything works fine.
Now I need to restrict the number of displayed modes: The JS app is fired up with a country code parameter, and it is always using the same NAServer. Not all travel modes apply for every country, so I need to filter out some of the travel modes before showing them in the Directions Widget.


Here's what I tried:

  • Find a setter to apply the filtered list. But there seems to be no setter: The Directions widget offers getSupportedTravelModeNames(), the RouteTask offers getServiceDescription(), which returns a Deferred object, that gives me supportedTravelModes. There is nothing for the complete list in the RouteParameters.
    => Getters only for the complete list.
  • DOM manipulation. dojo.query(".esriTravelModesTypeName") gives me the node where the travel modes menu appears, but I only get the one that is visible at the beginning. The others only appear when the user opens the menu, and that it too late to hide some child elements (or would at least result in an ugly effect).


Does someone have an idea?

Outcomes