Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker.js: - TypeError: Cannot read property 'DROP' of undefined #29

Open
michaelhna opened this issue Sep 20, 2017 · 1 comment
Open

Comments

@michaelhna
Copy link

Hello,

First of all I would like to thank you for writing and sharing this library!

I am working in WebIDE, using XML views and JS controllers. I have added a map in my 'Detail.view.xml' view similar to your blog post, and included the library in my 'Component.js' file (sap.ui.getCore().loadLibrary("openui5.googlemaps", "../openui5/googlemaps/")), and the map loads fine (I'm able to interact with it, move the draggable marker, etc).

I now wish to use the marker and polygon libraries to do some geofencing. In my 'Detail.controller.js' controller, I am unable to reference 'openui5.googlemaps', as it says "openui5 is not defined".

Instead, I have included the libraries using relative paths in 'sap.ui.define' at the top of the controller. Polygon.js loads without error, however, Marker.js gives the following error, so my controller won't even load: "Error: failed to load 'projectproperties/openui5/googlemaps/Marker.js' from ../openui5/googlemaps/Marker.js: TypeError: Cannot read property 'DROP' of undefined"

A similar error also happens when trying to include Map.js, except it complains about property 'ROADMAP'.

Do you know what would be causing these errors? Or do you have any suggestions for how to better utilize these libraries in my controller (for example, actually referencing the 'openui5.googlemaps' that was loaded in my component)? I cannot simply define 'projectproperties/openui5/googlemaps' like I did with Polygon.js, as it looks for an actual JS file with the name "googlemaps.js".

I have included a picture of my folder structure for reference, as well as the 'sap.ui.define' in my controller - please let me know if any other pictures/information would be helpful.
9-20-2017 1-48-19 pm

9-20-2017 1-59-05 pm

Thanks,

Michael

@connecttobn
Copy link

Try to use this way..

sap.ui.define([
..
"openui5.googlemaps.Polygon",
"openui5.googlemaps.Marker"], function(..., Polygon, Marker) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants