Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8470133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:25:54+00:00 2026-06-10T16:25:54+00:00

according to this , directionRenderer object’s method setRouteIndex() should Set the (zero-based) index of

  • 0

according to this, directionRenderer object’s method setRouteIndex() should Set the (zero-based) index of the route in the DirectionsResult object to render.

here is what i have done:

directionsService.route(request, function(response, status) {
                    if (status == google.maps.DirectionsStatus.OK) {
                        directionsDisplay.setRouteIndex(1);
                        console.log(directionsDisplay.getRouteIndex());
                        directionsDisplay.setDirections(response);
                        console.log(directionsDisplay.getRouteIndex());

} });

i know there are 3 alternative routes the query i am doing with. here, first console.log(directionsDisplay.getRouteIndex()); gives route no. 1, thats okay , but after the excecution of setDirections, the secong log gives the value 0!. that means the first route. i have enabled, alternative routes, provideRouteAlternatives:true, i also initiated the object like this:

var rendererOptions = {
     routeIndex:1 
    }
directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions);

But it still shows the route no. 0, not number 1. here is my webpage, please do check the source. thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:25:56+00:00Added an answer on June 10, 2026 at 4:25 pm

    I think you are misunderstanding something. You said:

    console.log(directionsDisplay.getRouteIndex()); gives route no. 1,
    thats okay , but after the excecution of setDirections, the secong log
    gives the value 0!.

    …and that’s OK too because you are resetting it with: directionsDisplay.setDirections(response);

    but you don’t need this line because the response is already loaded into the DirectionsRenderer object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According this article , generic JPA DAO(Data Access Object) is a pretty nice pattern.
According to this http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html article, I defnitely should. Quote Gentle, yet insistent executive summary:
According to this MSDN article , you should not catch general exceptions. I'm sure
According to this question (and common sense) I should be able to change characteristics
According to this article from Herb Sutter, one should always pick Class Specializing over
According to this article Silverlight 2 Beta 2 supports the DataContractJsonSerializer object. But, when
According to this http://perldoc.perl.org/UNIVERSAL.html I shouldn't use UNIVERSAL::isa() and should instead use $obj->isa() or
According to this , for best results in Leopard my $DISPLAY variable should start
According to this question and the documentation of attr_readonly the following should be possible:
According to this post: How to write a scalable Tcp/Ip based server jerrylvl states:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.