Hi…
I have added a geopoint to my Entity. And, i have added the Map in the Browser page of that Entity, So, i have multiple marker in the Map (because the map is connnected the browser Entity Data Container), So, when i click the Marker, I want to navigate to the Editor page of the Entity.
Please guide me how to navigate to the Editor page of the Entity, When i click the Marker in on the Map.
Hi, @Narayanan
You can subscribe to the VectorLayer.GeoObjectSelectedEvent
which is fired when you click on a geo-object on the map.
You can implement this in a screen controller this way:
@Subscribe("map.layer") //map - id of the GeoMap component, layer - id of the vector layer
private void onGeoObjectSelected(VectorLayer.GeoObjectSelectedEvent<YourEntity> event) {
screenBuilders.editor(YourEntity.class, this)
.editEntity(event.getItem())
.build()
.show();
}
Make sure to set this vector layer as selected layer of the map (in order to receive click events).
It can be done in the xml-descriptor:
<maps:geoMap id="map">
<maps:layers selectedLayer="yourLayer">
...
<maps:vector id="yourLayer" dataContainer="..."/>
</maps:layers>
</maps:geoMap>