goody
Some checks failed
gitea/abap_tutorial_11/pipeline/head There was a failure building this commit
Some checks failed
gitea/abap_tutorial_11/pipeline/head There was a failure building this commit
This commit is contained in:
30
webapp/controller/Details.controller.js
Normal file
30
webapp/controller/Details.controller.js
Normal file
@ -0,0 +1,30 @@
|
||||
sap.ui.define(["mvcapp00124/controller/BaseController"], function (Controller) {
|
||||
"use strict";
|
||||
/**
|
||||
* @param {typeof sap.ui.core.mvc.Controller} Controller
|
||||
*/
|
||||
|
||||
return Controller.extend("mvcapp00124.controller.Details", {
|
||||
onInit: function () {
|
||||
// bind the function _onRouteMatched to the event of navigating to the pattern "flights"
|
||||
this.getOwnerComponent()
|
||||
.getRouter()
|
||||
.getRoute("flights")
|
||||
.attachPatternMatched(this._onRouteMatched, this);
|
||||
},
|
||||
|
||||
_onRouteMatched: function (oEvent) {
|
||||
// get the flight id which was navigated to
|
||||
let sFlightId = oEvent.getParameter("arguments").flightId;
|
||||
|
||||
// get the flight data
|
||||
let oData = this.getOwnerComponent().getModel().getData();
|
||||
|
||||
// search for the flightId in the flight data
|
||||
let iIndex = oData.Flight.findIndex((oFlight) => oFlight.flightId === sFlightId);
|
||||
|
||||
// bind the view to the selected flight
|
||||
this.getView().bindElement("/Flight/" + iIndex);
|
||||
},
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user