chendl
chendl

Reputation: 1

how to integrate GoogleMap APIV3 into SmartGWT?

I am integrating gwt-maps-3.8.0-pre1.zip into aa application which using gwt-platform MVP and smartgwt. i have a mainpresenter and nested a presenterwidget into it. VLayout is used as parent's canvas and using HTMLPane as nested googlemap's canvas. GoogleMap can't be displayed correctly.but when i using firebug to monitor http data,I found the googlemap's information has been returned to browser,but i don't know why it can't be displayed correctly? anyone can help me? thanks!

Upvotes: 0

Views: 963

Answers (1)

jesse crossley
jesse crossley

Reputation: 56

You should ensure that your module's entry html includes the <script> tag for maps:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> 

Since you did see the googlemaps data, I would guess the APIs are being retrieved by your app and that the problem likely lies in the nested UI structure. In the few gwt-maps examples I've examined as well as in the app I'm working on, the map is maximized and and given its own <div> in the body of the entry html:

<body style="margin:0px;">
  <div id="map_canvas" style="width:100%; height:100%">Map is loading...</div>
</body>

With deeply nested containers, there's more of a chance of the browser sizing something to zero. Using Firebug or any other DOM Inspector, walk the tree of the DOM objects from <document> down to your map object's containing <div>. Check to see if any of the height properties are 0px and maximize those container objects using CSS or GWT methods.

Please report your findings; I'm sure nesting maps in layouts will be a common goal in the future and we will all benefit from what you learn.

Upvotes: 2

Related Questions