Skip to content

Issue creating map with HTMLPanel  #5

Open
@jerdoganTorrential

Description

@jerdoganTorrential

I have the following code.

public class MapWidget {

    Map itsMap;
    public MapWidget(HTMLPanel inHTMLPanel) {
        LatLng center = L.latLng(0, 0);
        HTMLElement mapElement = new HTMLElement();
        mapElement.innerHTML = inHTMLPanel.getElement().getInnerHTML();
        itsMap = L.map(mapElement, new MapOptions.Builder(center, 1, 1).build());
    }
    public HTMLElement getElement(){
        return itsMap.getContainer();
    }
}

I get the following error in my console.

MapWidget.java:21 Uncaught TypeError: Cannot read property 'gwidgets' of undefined

The line the it complains about is
HTMLElement mapElement = new HTMLElement();

I believe it has to use a builder to create that but looking at what is available from L class there doesn't seem to be one.

I was following what was done in the following issue #2

Any help would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions