Search code examples
sapui5sap-fiori

How to go to another view when a button is pressed?


I have Worklist view that contains a button. That button need to go to another view. How can I accomplish this?


Solution

  • Assuming you have your routes and targets set up in manifest.json you'll want to do somehing like this in your press event handler for the button.

    this.getRouter().getTargets().display([TARGET NAME FROM MANIFEST]);
    

    OR

    this.getRouter().navTo("NAME OF ROUTE FROM MANIFEST");
    

    Again like others have said this is highly dependent on use case, this is a general idea of what your solution may look like.