Hi
I'm using SmartGWT 3.0p and try to load Google Maps inside HLayout container. The code is prity simple:
static HLayout layout = new HLayout();
public void onModuleLoad() {
AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
options.setOtherParms("sensor=false&language=ja");
Runnable callback = new Runnable() {
public void run() {
renderMap();
}
};
layout.setHeight100();
layout.setWidth100();
layout.draw();
AjaxLoader.loadApi("maps", "3", callback, options);
}
public static void renderMap() {
LatLng myLatLng = LatLng.create(-34.397, 150.644);
MapOptions myOptions = MapOptions.create();
myOptions.setZoom(8.0);
myOptions.setCenter(myLatLng);
myOptions.setMapTypeId(MapTypeId.ROADMAP);
GoogleMap.create(layout.getElement(), myOptions);
}
and this doesn't work - the map is not shown on the browser. The same code but using pure GWT panels is working fine:
//static HLayout layout = new HLayout();
static LayoutPanel layout = new LayoutPanel();
public void onModuleLoad() {
AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
options.setOtherParms("sensor=false&language=ja");
Runnable callback = new Runnable() {
public void run() {
renderMap();
}
};
// layout.setHeight100();
// layout.setWidth100();
layout.setHeight("100%");
layout.setWidth("100%");
// layout.draw();
RootPanel.get().add(layout);
AjaxLoader.loadApi("maps", "3", callback, options);
}
public static void renderMap() {
LatLng myLatLng = LatLng.create(-34.397, 150.644);
MapOptions myOptions = MapOptions.create();
myOptions.setZoom(8.0);
myOptions.setCenter(myLatLng);
myOptions.setMapTypeId(MapTypeId.ROADMAP);
GoogleMap.create(layout.getElement(), myOptions);
}
Is there any solution on this?
I'm using SmartGWT 3.0p and try to load Google Maps inside HLayout container. The code is prity simple:
static HLayout layout = new HLayout();
public void onModuleLoad() {
AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
options.setOtherParms("sensor=false&language=ja");
Runnable callback = new Runnable() {
public void run() {
renderMap();
}
};
layout.setHeight100();
layout.setWidth100();
layout.draw();
AjaxLoader.loadApi("maps", "3", callback, options);
}
public static void renderMap() {
LatLng myLatLng = LatLng.create(-34.397, 150.644);
MapOptions myOptions = MapOptions.create();
myOptions.setZoom(8.0);
myOptions.setCenter(myLatLng);
myOptions.setMapTypeId(MapTypeId.ROADMAP);
GoogleMap.create(layout.getElement(), myOptions);
}
and this doesn't work - the map is not shown on the browser. The same code but using pure GWT panels is working fine:
//static HLayout layout = new HLayout();
static LayoutPanel layout = new LayoutPanel();
public void onModuleLoad() {
AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
options.setOtherParms("sensor=false&language=ja");
Runnable callback = new Runnable() {
public void run() {
renderMap();
}
};
// layout.setHeight100();
// layout.setWidth100();
layout.setHeight("100%");
layout.setWidth("100%");
// layout.draw();
RootPanel.get().add(layout);
AjaxLoader.loadApi("maps", "3", callback, options);
}
public static void renderMap() {
LatLng myLatLng = LatLng.create(-34.397, 150.644);
MapOptions myOptions = MapOptions.create();
myOptions.setZoom(8.0);
myOptions.setCenter(myLatLng);
myOptions.setMapTypeId(MapTypeId.ROADMAP);
GoogleMap.create(layout.getElement(), myOptions);
}
Is there any solution on this?
Comment