OpenSAP Ui51 Week4 Unit 1 NARC Exercise
OpenSAP Ui51 Week4 Unit 1 NARC Exercise
OpenSAP Ui51 Week4 Unit 1 NARC Exercise
Table of Contents
1
2
3
Preview
<ToolbarSpacer />
<SearchField
id="searchField"
tooltip="{i18n>worklistSearchTooltip}"
search="onSearch"
width="auto">
</SearchField>
<Button id="addButton" icon="sap-icon://add"
press="onAdd" />
</Toolbar>
</headerToolbar>
/* =========================================================== */
/* event handlers
*/
/* =========================================================== */
/**
* Event handler when the add button gets pressed
* @public
*/
onAdd: function() {
this.getRouter().navTo("add");
},
The onAdd function we reference within the Worklist.view.xml has to be defined in the
Worklist.controller.js. When this function is called, we simply navigate to the add route,
which still has to be defined.
webapp/manifest.json
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "opensap.manageproducts.view",
"controlId": "app",
"controlAggregation": "pages",
"bypassed": {
"target": "notFound"
},
"async": true
},
"routes": [
{
"pattern": "",
Copyright/Trademark
Now we have to define the route and corresponding target within the manifest.json. The pattern of
the route is AddProduct and it is named add, like we already referenced it within the
Worklist.controller.js. The corresponding target references the Add.view.xml which we still
have to implement.
Copyright/Trademark
Within the i18n.properties file we add the title for the page title of the Add.view.xml.
Copyright/Trademark
Coding Samples
Any software coding or code lines/strings (Code) provided in this documentation are only examples
and are not intended for use in a productive system environment. The Code is only intended to better
explain and visualize the syntax and phrasing rules for certain SAP coding. SAP does not warrant the
correctness or completeness of the Code provided herein and SAP shall not be liable for errors or
damages cause by use of the Code, except where such damages were caused by SAP with intent or
with gross negligence.
Copyright/Trademark