views:

199

answers:

1

I am trying to use DirectionsRenderer to display a DirectionsResult without the route list. According to the API version 3 documentation, there is a "hideRouteList" property of the DirectionsRendererOptions object that when set to true should hide the route list. I cannot get it to work. Is this a bug or am I just not coding this correctly? Following is my code.

<html>
<head>
<title>Driving Directions</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"&gt;    </script>
<script type="text/javascript">
<!--
function initialize() {
    var dirService = new google.maps.DirectionsService();
    var dirRequest = {
          origin: "350 5th Ave, New York, NY, 10118",
          destination: "1 Wall St, New York, NY",
          travelMode: google.maps.DirectionsTravelMode.DRIVING,
          unitSystem: google.maps.DirectionsUnitSystem.IMPERIAL,
          provideTripAlternatives: true
    };
    dirService.route(dirRequest, showDirections);
}

function showDirections(dirResult, dirStatus) {
    if (dirStatus != google.maps.DirectionsStatus.OK) {
        alert('Directions failed: ' + dirStatus);
        return;
    }
    var rendererOptions = {
        hideRouteList: true
    };
    var dirRenderer = new google.maps.DirectionsRenderer(rendererOptions);  
    dirRenderer.setPanel(document.getElementById('dir-container'));
    dirRenderer.setDirections(dirResult);
}
-->
</script>
</head>
<body onLoad="initialize();">
<div id="dir-container"></div>
</body>
</html>
+1  A: 

I tried this out and I don't think you are doing anything wrong. Looks like this option is broken. I couldn't find it in the known issues, so I think this is a new one. When I get a chance I'll write it up.

Cannonade
Logged an issue here -> http://code.google.com/p/gmaps-api-issues/issues/detail?id=2247
Cannonade