on 2020 Feb 26 4:49 PM
The question is about Router and the process of creation of a "target" view in async mode.
Controller of a root view (rootView) is able to wait for the metadata in onInit function:
onInit: function() {
var model = this.getView().getModel(); model.metadataLoaded().then( function() { //.. ok!
However this is not possible in any other controller of a target view (even if I make a root view as a target). Model like this.getView().getModel() comes after rendering of a target and not on init.
If I check network tab the sequence is:
My questions are:
If you check most of documentation and tutorials there is no async mode in manifest, or there is no such an issue. My main configuration below (notice async is true):
"rootView": {
"viewName": "my.path.view.App",
"type": "XML",
"async": true,
"id": "app"
},
...
"dataSource": "MY_SRV",
"preload": true
...
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"async": true,
"viewPath": "my.path.view",
"controlAggregation": "pages",
"controlId": "app",
"transition": "slide",
"viewLevel": 1
},
"routes": [{
"pattern": "",
"name": "master",
"target": "master"
}, {
"pattern": "/{ID}",
"name": "product",
"target": "product"
}],
"targets": {
"master": {
"viewName": "Master",
"viewId": "master",
"viewLevel": 1,
"clearControlAggregation": true
},
"product": {
"viewName": "Product",
"viewLevel": 2,
"clearControlAggregation": true
}
}
}
in init, you have to use this.getOwnerComponet().getModel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
63 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.