cancel
Showing results for 
Search instead for 
Did you mean: 

GeoMap AttachClick Doesn't Fire Events

Former Member
0 Kudos

I haven't been able to get the GeoMap to fire a click events. Has anyone been able to get this to work or is this a bug? See simple MVC example below:

Thx

//** ScnMain.controller.js

sap.ui.controller("scn.ScnMain", { });

//** ScnMain.view.js

function clickFunction(ev) {

  console.log("clickFunction ev="+ev);

};

sap.ui.jsview("scn.ScnMain", {

  getControllerName : function() {  return "scn.ScnMain"; },

  createContent : function(oController) {

  var oLayout = sap.ui.commons.layout.VerticalLayout("appLayout", { width: "100%" });

  oLayout.addContent(new sap.ui.commons.ApplicationHeader("appHeader"));

  var gm = new sap.ui.vbm.GeoMap();

  gm.attachClick(clickFunction);

  oLayout.addContent(gm);

  return oLayout;

  }

});

//** index.html

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta http-equiv='Content-Type' content='text/html;charset=UTF-8' />

<script src="resources/sap-ui-core.js" id="sap-ui-bootstrap"

        data-sap-ui-libs="sap.ui.commons" data-sap-ui-theme="sap_bluecrystal"></script>

<script>

  sap.ui.localResources("scn");

  var view = sap.ui.view({id:"idScnMain1", viewName:"scn.ScnMain", type:sap.ui.core.mvc.ViewType.JS});

  view.placeAt("content");

  }

</script>

</head>

<body class="sapUiBody" role="application">

  <div id="content"></div>

</body>

</html>

Accepted Solutions (1)

Accepted Solutions (1)

seVladimirs
Active Contributor
0 Kudos

Joseph - I agree that information on SDK is misleading, JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.vbm.GeoMap

I was able to attach "click" event only to GeoMap aggregations. Beside to that I also have checked GeoMap-dbg.js https://sapui5.hana.ondemand.com/sdk/resources/sap/ui/vbm/GeoMap-dbg.js and click event is not defined and as result nothing happen when you click on the Map itself.

Here you can see how click is working, please click on Pin Element

JS Bin - Collaborative JavaScript Debugging

And here Visual Business UI5 Tests Index you can find more examples with VBI

Cheers

seVladimirs
Active Contributor
0 Kudos

So I have debugged VBI libs and managed to get mouse position on mouse click. See here - JS Bin - Collaborative JavaScript Debugging

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos
Former Member
0 Kudos

Would you happen to know how to change the mouse coordinates [getOffsetX() & getOffsetY()] into the geomap coordinates (Latitude & Longitude)?

former_member182372
Active Contributor
0 Kudos

Sorry, no