jasper07 / openui5-googlemaps

Openui5 Googlemaps library
MIT License
65 stars 43 forks source link

Include Library Issue #2

Closed jenswachtel closed 8 years ago

jenswachtel commented 9 years ago

I am using WebIDE with a Master-Detail template. Unfortunately, I can't load the library there. Moved all files to MyApplication/openui5/googlemaps/... My Controller: sap.ui.getCore().loadLibrary("openui5.googlemaps", "../openui5/googlemaps/");

But it always tries to load the file from:

http://.....trial.dispatcher.hanatrial.ondemand.com/resources/openui5/googlemaps/Map.js 404 (Not Found)
Uncaught Error: failed to load 'openui5/googlemaps/Map.js' from resources/openui5/googlemaps/Map.js: 404 - Not Found

which confues me, since I nowhere defined "resources". I can call the script successfully with http://.....trial.dispatcher.hanatrial.ondemand.com/openui5/googlemaps/Map.js

Even though I created a folder /resources/openui5/googlemaps/ with the same files, I am not able to open any url within /resources/ (404)

Any idea what I am missing to get your library running?

Thanks, Jens

jasper07 commented 9 years ago

Hi Jens, Your issue is around relative resource paths and not really anything to do with the GMap Library.

I dont use WebIDE for development but did notice the following in the template code

"// always use absolute paths relative to our own component"

what i think your problem is and you can confirm by looking in the Developer Console -> Network, the application is trying to look in the wrong place,

the quick fix given the app root http://.....trial.dispatcher.hanatrial.ondemand.com would be sap.ui.getCore().loadLibrary("openui5.googlemaps", "/openui5/googlemaps/");

but this wouldn't work if deployed via Fiori Launchpad, for the app to consistently look in the right place you need to set an absolute path

myRootPath = jQuery.sap.getModulePath("MyApplication"); sap.ui.getCore().loadLibrary("openui5.googlemaps", [myRootPah,"openui5/googlemaps/"].join("/"));

if that doesn't help raise a question in either SCN or SDN and ping me in question. JSP