Can anybody explain what exactly Aggregation means in SAP UI5 ? I am trying to make an app with two views and i want to navigate from one view to another and vice -versa. So , the APP control is having aggregation , so i am confused what Aggregation is ?
相关问题
- How to Load Dependencies Relative to Defining Modu
- Shared event handler for XML views with different
- UI5 performance parameters: data-sap-ui-preload vs
- Event for view leave
- How can I access the AST that VSCode creates
相关文章
- How to use “formatMessage” module with i18n model
- where are the SAPUI5 icons stored?
- How to input only month and year in UI5?
- SAPUI5 JSONModel and JSONP
- Required field validator in sapui5
- How to group SAPUI5 OData before bind to control a
- Perform Action after the Binding Is Complete
- SAPUI5 / OpenUI5: Packaging
Basic definition of «aggregation» from Glossary:
For example, a list may have 0 or many items. An item has 0 or 1 list as its parent. Therefore, the list has an aggregation of «items».
In our case, the control
sap.m.App
, which is extended fromsap.m.NavContainer
, has a default aggregation named «pages» where we can define a collection of anything extended fromsap.ui.core.Control
as its child controls.But just adding the views manually into
<pages></pages>
is an anti-pattern since a view has usually a Page in it and a single page takes up 100% of the height which pushes other views away. Besides that, it makes implementing navigation much more difficult.Instead, the current best practice is to use a so-called «router» which is usually defined in the application descriptor (manifest.json) with other navigation properties. Its sister control Target takes care of adding the navigated view to the «pages» aggregation. To find out how to achieve navigation using a router, take a look at these resources:
This question is a little too broad for SO and you did not really investigate before by e.g. reading the documentation. Hence the downvotes.
Nevertheless, I will link you to the appropriate documentation page and provide a short excerpt and explication:
In a nutshell, aggregations in UI5 have mostly the same meaning as a typical OOP aggregation: they represent
has-a
or conversely ais-a-part-of
relationship between controls. Tables have rows, rows have cells and so on. The lifecycles of the related controls are bound (when the parent is destroyed, the children are also destroyed).When looking strictly at aggregations, a UI5 application consists of a tree of controls, where the controls of one level are part of an aggregation of a control from the level above.
Each aggregation has its own semantics. For example the
items
of asa.m.Table
are displayed between theheader
and thefooter
and thepages
of aNavContainer
are displayed one at a time. The behavior of the aggregation contents is generally described in the SDK reference.