Skip to Content
0
Jun 12, 2020 at 03:46 PM

Creating Context Path

180 Views

Dear all,

I try to decipher this code that is part of PO Report SAPUI5 Fiori:

jQuery.sap.require("sap.ca.scfld.md.controller.BaseDetailController");
sap.ca.scfld.md.controller.BaseDetailController.extend("ui.s2p.mm.purord.tracking.view.S3", {

oView : null,
oModel : null,
aItems : null,
sContextPath : null,
    onInit: function() {
        //execute the onInit for the base class BaseDetailController
        sap.ca.scfld.md.controller.BaseDetailController.prototype.onInit.call(this);
        this.oView = this.getView();
        this.oModel = this.oView.getModel();
       
        this.oRouter.attachRouteMatched(function(oEvent) {
             if (oEvent.getParameter("name") === "detail") {
             // Replace only happens when navigating from master list (selection)
             // When navigating back from POItem, the context path is already correct and there will be no replacement
             
             this.sContextPath = oEvent.getParameter("arguments").contextPath.replace("POLists","PODetailedDatas");}

It is part of one of the controllers, could you explain what does the following part:

this.sContextPath = oEvent.getParameter("arguments").contextPath.replace("POLists","PODetailedDatas");}

does? How come I cannot find contextPath.replace in the SAPUI5 API documentation?

regards