Tuesday, October 18, 2011

[Google Maps API v2] Re: my locations page adding second line

On Oct 18, 3:32 pm, rmcguire <rmcgu...@meadowlarkco.com> wrote:
> On my info windows for my points how can I add in a second line on my
> TYPE_HUBS, for the name variable for instance if I want to add a
> second line after 'Salt Lake City, UT' on a line below.

Your infoWindow content is HTML, constructed as
'<div>' + obj.name + '</div>'

so obj.name is basically HTML, and for the Salt Lake City marker the
infoWindow content is
'<div>Salt Lake City, UT</div>'

So for another line, say
'<div>Salt Lake City, UT<br>I like it here</div>'

you need to work back to the name attribute of your data and make sure
it contains what you want:
name: 'Salt Lake City, UT<br>I like it here'

Or, have another attribute, say
secondline: 'I like it here'

and use that:
'<div>'+obj.name+'<br>'+obj.secondline+'</div>'

Note that if you do this, you do need to specify a "secondline"
attribute, or you'll get "undefined" in your infoWindow, which is
probably undesirable. Using the first method you specify exactly what
you want and how you want it to appear.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate