Hi All,
Why should we use App.view.xml in SAP UI5 ? If we don't use this and don't add other views as pages to it, will it impact anything ?
Please enlighten me.
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
when you generate a ui5 project (worklist mainly), it generates this file and uses it as the root view.
Why?
Because the root view has App control, this is inheriting the navcontainer and now you should get an idea that App acts like a nav container, it doesn't necessarily needs to be an App control, it can be SplitApp or other controls that supports this mechanism.
It doesn't stop there, this root view is used by Routing and in the routing we mention the aggregation as pages, and provides different routes, what SAP UI5 framework does it to put the views that we mentions in the target inside the App control dynamically when the respective route pattern is matched.
We can do this manually as well, but if we provide rootView and routing, SAP will take care of dynamically showing the views bases on the pattern and makes our development effort a lot easier.
Thanks,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think I understand your question now. I would say it always makes sense to have a root view, so you can share some common UI elements across your entire web app (such as the shellbar or the header/footer of the app). Which is why the manifest "asks" you for this information. It is just more convenient to implement one page per XML file and not to bother about the surrounding elements.
I think you can also use different containers besides sap.m.App as a root view. And you can also leave out the "routing" part of the manifest.json entirly if you don't want to use any container (and handle the aggregations manually).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you need a view for SAPUI5 apps to declare the UI components (Shellbar, lists, tables, buttons) you want to display. A web app without any UI components wouldn't make much sense. The file name can be freely chosen but the ending must always be "view.xml".
The only exception are Fiori Elements (which already come with a default layout and content).
I hope this helped
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sorry I think my question was not clear. I know what is the purpose of the view. But in UI5 usually we have App.view.xml as root view and then using routing we add other views against 'pages' aggregation of app view. I want to understand why so ?
App.view.xml

in manifest.json

routing:
"routing": { "config": { "routerClass": "sap.m.routing.Router", "viewType": "XML", "async": true, "viewPath": "com.mylan.notifList.view", "controlAggregation": "pages", "controlId": "oAPP", "clearControlAggregation": false }, "routes": [ { "name": "notifList", "pattern": "", "target": [ "notifList" ] }, { "name": "notifDetail", "pattern": "notifDetail/{notifID}", "target": [ "notifDetail" ] } ],
it is just general practice. you can go without it.
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.