on ‎2022 Jun 22 10:52 AM
Hi all
i need to dynamically add a route and a target to my sapui5 app
For the route i found this one:
https://answers.sap.com/questions/12593047/how-to-dynamically-add-route-to-a-standard-app.html
But for targets i didnt found anything 😞
Any idea would be appreciated
Thanks
Nicola
Request clarification before answering.
Hello Nicola,
I think you can still get it done.
Have look at this and see if this matches your requirement.
Obviously this could break whenever you upgrade the SAPUI5 library as private properties are used.
// this = Component
let aTargets = this.getRouter().getTargets();
let oConfig = this.getRouter()._oConfig;
// Add a target
aTargets.addTarget("YourTargetName", {
...oConfig, ...{
viewPath: "Path to your view",
viewName: "Name of your view",
viewLevel: 1,
rootView: this.createId("app") // Should be the id defined in manifest.json for routing -> config -> controlId
}
});
// Add target to route
this.getRouter().getRoute("YourRouteName")._oConfig.target.push("YourTargetName");<br>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i solved in this way
right now it works well
init: async function () { // call the base component's init function UIComponent.prototype.init.apply(this, arguments); let that = this;Hi Nicola,
this is currently not supported. We have it in our backlog.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Florian,
i solved in this way, in Component.js
init: async function () { // call the base component's init function UIComponent.prototype.init.apply(this, arguments); let that = this;Works like a charm
@FlorianVogt, Is it still in a backlog?
| User | Count |
|---|---|
| 14 | |
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.