on 2018 Mar 07 8:12 PM
Hi, brothers.
I need to change the uri before the call, how can I do it?
manifest.json
"dataSources": {
"mainService": {
"uri": "http://sapmiidev:56500/XMII/IlluminatorOData/QueryTemplate?QueryTemplate=Interrupcoes/TelasPortal/RegistrarInterrupcao/Query/XQry_Interrupcoes_Sel_UI5",
"type": "JSON"
}
},
Component.js
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"mycompany/myapp/model/models",
"mycompany/myapp/controller/ErrorHandler"
], function(UIComponent, Device, models, ErrorHandler) {
"use strict";
return UIComponent.extend("mycompany.myapp.Component", {
metadata: {
manifest: "json"
},
init: function() {
//set param (variable session) in uri.
this.getMetadata().getManifestEntry("sap.app").dataSources["mainService"].uri =
"http://sapmiidev:56500/XMII/IlluminatorOData/QueryTemplate?QueryTemplate=" +
"Interrupcoes/TelasPortal/RegistrarInterrupcao/Query/XQry_Interrupcoes_Sel_UI5"+
"&Param.1=xxx" + param;
// call the base component's init function
UIComponent.prototype.init.apply(this, arguments);
// initialize the error handler with the component
this._oErrorHandler = new ErrorHandler(this);
// set the device model
this.setModel(models.createDeviceModel(), "device");
// create the views based on the url/hash
this.getRouter().initialize();
}
});
});
Request clarification before answering.
According to the documentation, manifest models are created before component initialization.
Since you are using a json model, is it an option to use loadData method with the new uri?
this.getModel().loadData(uri);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
61 | |
8 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.