cancel
Showing results for 
Search instead for 
Did you mean: 

sapui5 - Popup - Navigate to another xml view

0 Kudos

Dear UI5 experts

I am extending an fiori app and have replaced a view and placed a popup. Now my requirement is when I click the close button in the popup I want to open an xmlview.

code.

sap.m.MessageBox.error( "Error Message - some error", 
{ icon: sap.m.MessageBox.Icon.ERROR, title: "Confirmation Error", onClose: function (oAction) { <br> this.router = sap.ui.core.UIComponent.getRouterFor(this); <br>this.router.navTo("customview"); } } );

can some one pls advise on the error I am getting.

'navTo' of undefined

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
Active Contributor

var that=this;

sap.m.MessageBox.error("Error Message - some error", {icon:sap.m.MessageBox.Icon.ERROR,title:"Confirmation Error", onClose: function (oAction) { <br> that.router = sap.ui.core.UIComponent.getRouterFor(that); <br>that.router.navTo("customview"); } } );

usually you can use that way to bypass "this" issue.

0 Kudos

Dear Jun,

thank you!

that helped, however I am still unable to open the xmlview. below is my manifestjson. the app is an extending app and I have replaced a view. getting an error -

No component handle available for 'publicservices.her.myApp.myAppExtension'; fallback to component.load() -  sap.ushell.components.container.ApplicationContainer

manifest.json (In my extended app)

"routing": {
   "config": {
    "routerClass": "sap.m.routing.Router",
    "viewType": "XML",
    "viewPath": "publicservices.her.myApp.myAppExtension.view",
    "controlId": "app",
    "controlAggregation": "pages",
    "async": true
   },
   "routes": [{
    "pattern": "",
    "name": "customView",
    "target": "customView"
   }
   ],
   "targets": {
   
    "customView": {
    "viewName": "customView",
     "viewId": "customView"
    }
   }
  }
 }