I have a question regarding routing in SAPUI5. I have a SplitApp container with two master views. The first master view displays a list of equipments. The second master view displays a list of measuringpoints of the chosen equipment. The data is (by now) located in a clientside JSON model wich looks like this:
{
"Equipments": [
{
"EquipmentNr": "Equipment 0000000001",
"Messpunkte": [
{
"MesspunktNr": "Messpunkt 01"
},
{
"MesspunktNr": "Messpunkt 02"
},
{
"MesspunktNr": "Messpunkt 03"
}
]
},...The detail page now should be able to access the "Messpunkt" chosen in the second masterview but I am not able to pass the parameters via routing. The routing configuration for routing to the detail view:
"routes": [...
{
"pattern": "master/{equiPath}/detail/{impttPath}",
"name": "detail",
"target": "detail"
}
],
"targets": {
...
"detail": {
"viewName": "DetailPage",
"controlAggregation": "detailPages",
"parent": "master"
}
}I am not sure how to call the navTo method in the controller of masterpage2 because when i try to it always gives me an error saying "The segment {equiPath} is required."
when calling the onNavToDetail method in this form:
onNavToDetail : function(oEvent) {
var oItem = oEvent.getSource();
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("detail", {
equiPath: oItem.getBindingContext("equi").getPath().substr(0)
});i get the whole path e.g. "/Equipments/0/Messpunkte/0" for segment "{equiPath}
the information in the documentation "working with nested components" doesn't really help me. Thanks for ever help. Best wishes
Request clarification before answering.
I changed the "routes" and the "targets" section of the routing configuration. It now looks like:
"routes": [...
{
"pattern": "detail/{impttPath}",
"name": "detail",
"target": "detail",
"parent": "master"
}
],
"targets": {
...
"detail": {
"viewName": "DetailPage",
"controlAggregation": "detailPages"
}
}When calling the app via URL with the Pattern /master/0/detail/0 the routing mechanism works. (the pattern of the "master" route is "pattern": "master/{equiPath}" and is the parent of the "detail" route). The mistake must be in the onNavToDetail function. But by now i didn't figure out where.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.