Actually I think that was a red herring - setting the parentElem style
just forced a re-render and changing the map size had the same effect.
I think the problem is due to the map trying to initialize itself
before layout() is called. If I add a holder panel like this:
SimplePanel holder = new SimplePanel();
p.add(holder);
and then add the map after layout() like:
p.layout();
MapWidget map = new MapWidget(LatLng.newInstance(50, 50), 8);
map.setWidth("100%");
map.setHeight("100%");
holder.add(map);
it works.
I have one question about threading in the browser - I have used YUI
LayoutManager which is very similar to DockLayoutPanel.
http://developer.yahoo.com/yui/examples/layout/nested_layout.html
If you want to nest layouts or use a map inside a layout you need to
register a listener for an onrender event. When I asked why, Dave
Glass said that although the JS is single threaded, the DOM elements
will not be created by serially so you must wait until the event fires
before you can safely layout nested items that depend on the parent
layout.
Could this be a problem here also?
Thanks,
John
On Sep 28, 7:06 pm, jd <[email protected]> wrote:
> I have found the issue and am not sure how to fix it using the current
> API. After setting 100% height and width on both the DockLayoutPanel
> and RootLayoutPanel the map still reported a span of 0 and did not
> render correctly. In Safari's Inspector I could see that the only
> element without 100% height and width was the generated "layout
> parent" element but after changing this in using the inspector it
> worked.
>
> So I think I need to be able to access the Layout.parentElem to modify
> its style.
>
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---