私のアプリケーションには、ここにJavascript APIライブラリのマップを使用する必要があります。私がスタンドアローンのアプリケーションを実行するとうまく動作します(index.htmlにインクルードしているので)。しかし、HANA Cloud Platformに展開してHCP Portalサイト内で実行しようとすると失敗します。 index.htmlが使用されていないので、Component.jsにライブラリファイルをロードする必要があることは知っています。私の問題は、マップを描画する前に4つの異なるjsファイルと1つのスタイルシートをロードする必要があることです。私はjQuery.sap.includeScript()
とjQuery.sap.includeStyleSheet()
の機能を使用していますが、ライブラリファイルがロードされる前に私のrootviewのonInitとonAfterRendering()が呼ばれています(クロムのネットワークタブではステータスが "保留中"となっています)。私はロード/ライブラリファイルがロードされた後にのみビューを初期化するにはどうすればよいサードパーティのライブラリをSAPUI5にロード
UsingjQuery.sap.includeScript().then() in HCP Firori Launchpad
:
は、私は以下の記事を追いました。このすべてをcomponent.jsで行うのは正しいですか? manifest.jsonはこれを達成するために何らかの役割を果たしますか?
例が参考になります。 ありがとうございました。
マイコンポーネントのinitのコードは以下の通りです:
init: function() {
// call the base component's init function
UIComponent.prototype.init.apply(this, arguments);
var that = this;
//Load the here maps library
jQuery.sap.includeScript("https://js.api.here.com/v3/3.0/mapsjs-core.js", "hereMapsCore", $.proxy(function(succ) {
jQuery.sap.includeScript("https://js.api.here.com/v3/3.0/mapsjs-service.js", "hereMapsService", $.proxy(function(succ) {
jQuery.sap.includeScript("https://js.api.here.com/v3/3.0/mapsjs-ui.js", "hereMapsUi", $.proxy(function(succ) {
jQuery.sap.includeScript("https://js.api.here.com/v3/3.0/mapsjs-mapevents.js", "heremapsEvent", $.proxy(function(succ) {
jQuery.sap.includeStyleSheet("https://js.api.here.com/v3/3.0/mapsjs-ui.css", "hereMapscss", $.proxy(function() {
// UIComponent.prototype.init.apply(this, arguments);
// set the device model
this.setModel(models.createDeviceModel(), "device");
var a = this;
}, this));
}, this), function(oErr) {
MessageBox.alert("Map File not loaded");
});
}, this), function(oErr) {
MessageBox.alert("Map File not loaded");
});
}, this), function(oErr) {
MessageBox.alert("Map File not loaded");
});
}, this), function(oErr) {
MessageBox.alert("Map File not loaded");
});
}