Re: [Google Maps API v3] DirectionsRenderer.setDirections() : callback issue

482 views
Skip to first unread message
Message has been deleted

Chris Broadfoot

unread,
Jan 6, 2011, 8:35:10 PM1/6/11
to google-map...@googlegroups.com
Yep. Use a callback. Check the docs here:


Chris

On Thu, Jan 6, 2011 at 9:48 PM, Matei <mfoc...@gmail.com> wrote:
Hi everybody.
 
This is my first post on this forum :)
 
So I'm actually having my first steps with the Google Maps API v3 and try to use the directions service, based on examples provided in the online documentation.
 
Everything is fine except when it comes to use the setDirections() function. If my understanding is correct, this function is called with a DirectionsResult parameter, which will create all necessary overlays and display them on the map, and also generate the HTML corresponding to the directions and destined to the <div> element provided previously.
 
What is annoying is that all these tasks will be performed asynchronously so I find a way to execute code AFTER these tasks are completed !
 
So does anyone know a way to achieve this (e.g. via callback) ?
 
Thanx in advance

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Matei

unread,
Jan 11, 2011, 2:46:48 AM1/11/11
to google-map...@googlegroups.com
Hi.
 
How to use a callback is PRECISELY what I'm asking for. Providing a link to the main API v3 doc is therefore quite useless.
I didn't find any way to provide setDirections with a callback function. Looks like once setDirections is called, there is no way to control the code execution 

geoco...@gmail.com

unread,
Jan 11, 2011, 3:06:56 AM1/11/11
to Google Maps JavaScript API v3
This looks interesting:
directions_changed None This event is fired when the rendered
directions change, either when a new DirectionsResult is set or when
the user finishes dragging a change to the directions path.

-- Larry

Matei

unread,
Jan 11, 2011, 9:18:12 AM1/11/11
to google-map...@googlegroups.com
Thanx for the clue Larry.
 
But unfortunately it doesn't work.
When directions_changed event is fired, DirectionsRenderer.getPanel().innerHTML will return an empty string, which normally menas the HTML content of the panel has not been rendered yet.
 
What do you think about ?
Matei
Reply all
Reply to author
Forward
0 new messages