on 07-18-2020 6:49 PM
hello everyone,
I tried the following code but it's not working.
fragment
AddProductHierarchySet.fragment.xml
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns:tnt="sap.tnt" xmlns:l="sap.ui.layout">
<Dialog title="PRODUCT HIERARCHY SET INFORMATION" contentHeight="70%" contentWidth="70%">
<content>
<mvc:XMLView viewName="Rmanagement.FRebateManagement.view.CollectionGroupDetails"/>
</content>
<endButton>
<Button text="Close" press="onCloseFragment"/>
</endButton>
</Dialog>
</core:FragmentDefinition>
manifest.json:
view
collectionGroupDetails.view.xml:
collectionGroupDetails.controller.js
Hi Abhishek,
I see no reason why you should not get the router object.
Since I do not know the complete router configuration. Please also validate it is as specified in the documentation.
The passed controller or view has to be created in the context of a UIComponent to return the router instance. Otherwise this function will return undefined. You may define the routerClass property in the config section of the routing to make the Component create your router extension.
If this also doesn't work, try getting the router object from component itself.
var oRouter = this.getOwnerComponent().getRouter();
Thanks
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhishek,
{
"_version": "1.3.0",
"sap.app": {
"_version": "1.3.0",
"id": "com.prashil.test",
"type": "application",
"resources": "resources.json",
"i18n": "i18n/i18n.properties",
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"applicationVersion": {
"version": "${project.version}"
},
"ach": "XX",
"dataSources": {
"mainService" : {
"uri": "/api/users",
"type" : "OData",
"settings": {
"odataVersion": "2.0"
}
}
},
"sourceTemplate": {
"id": "test",
"version": "1.0.0"
}
},
"sap.fiori": {
"_version": "1.1.0",
"registrationIds": [],
"archeType": "transactional"
},
"sap.ui": {
"_version": "1.3.0",
"technology": "UI5",
"icons": {
"icon": "sap-icon://detail-view",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": [
"sap_hcb",
"sap_bluecrystal"
]
},
"sap.ui5": {
"_version": "1.2.0",
"rootView": {
"viewName": "com.prashil.test.view.App",
"type": "XML",
"id": "app"
},
"dependencies": {
"minUI5Version": "${sap.ui5.dist.version}",
"libs": {
"sap.ui.core": {
"minVersion": "1.36.0"
},
"sap.m": {
"minVersion": "1.36.0"
}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "com.prashil.test.i18n.i18n"
}
},
"": {
"dataSource": "mainService",
"settings": {
"metadataUrlParams": {
"sap-documentation": "heading"
}
}
}
},
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "com.prashil.test.view",
"controlId": "idAppControl",
"controlAggregation": "pages",
"clearControlAggregation" : false,
"bypassed": {
"target": [
"master",
"notFound"
]
},
"async": true
},
"routes": [
{
"pattern": "",
"name": "Main",
"target": [
"main"
]
},
{
"pattern": "newPage/type/:idType/value/:idValue",
"name": "newPage",
"target": "detail"
}
],
"targets": {
"main": {
"viewName": "Main",
"viewLevel": 1,
"viewId": "master",
"controlAggregation": "pages"
},
"detail": {
"viewName": "Detail",
"viewLevel": 1,
"viewId": "detail",
"controlAggregation": "pages"
},
"sflight": {
"viewName": "SFlight",
"viewLevel": 1,
"viewId": "flight",
"controlAggregation": "pages"
}
}
}
}
}
Thanks
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhishek,
Again, I tried similar code and for me it all worked well.
Few things that I avoided that you can also check, you have multiple controlId's in your target. I am not sure about the intention behind it but usually, this should be the control id of your App control.
Secondly, your have id "idApp" for your control and your target as well.
If your view Tile is the rootView then it should have been added as the rootView inside "sap.ui5" and no in routing.
Try fixing the above point and share the specific error your are facing.
Thanks
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhishek,
One point is the routing name "AddCollectionItem" has two arguments "groupId" and "itemId", while you are using only "groupId".
As per the error, you are not getting the router object, please check if you have initialized router in your component.js using
this.getRouter().initialize();
Thanks
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.