Adding gmap to div

UI Components for JSF
Post Reply
mgs76
Posts: 8
Joined: 25 Nov 2010, 10:16

25 Nov 2010, 10:21

Hello,

how can I use gmap for a map that has no fixed size in a div-tag?

Google code:

Code: Select all

function initialize() {
    var latlng = new google.maps.LatLng(48.780218, 9.167211);
    var myOptions = {
      zoom: 17,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("locate"), myOptions);
  }
....
<div id="locate"/>
Is it posible with the widgetVar? Or the other way round?

Thanks

Michael

mgs76
Posts: 8
Joined: 25 Nov 2010, 10:16

29 Nov 2010, 10:13

I tried following:
- set style to "width:100%;height:100%" -> no map
- no style -> no map

Any idea how to get a map with no fixed size?

Thanks

Michael

mgs76
Posts: 8
Joined: 25 Nov 2010, 10:16

29 Nov 2010, 10:21

I found the solution:
gmap is rendered to a div. Just give the gmap-tag the id the div should have and it works:

Code: Select all

<p:gmap id="locate" center="41.381542, 2.122893" zoom="15" type="hybrid" />

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests