Skip to Content
avatar image
Former Member

How to navigate to another view by clicking on tile container ?

Hi All,

I am trying to navigate to another view by clicking on tile container.

Please find the code below:

firstscreenController.js:

var oTileContainer = this.getView().byId("container");

//Get Genetared Tile IDs

oTileContainer.addEventDelegate

({ onAfterRendering: function()

{ //Get Aggregation Tiles of tile container

var oTiles = tileContainer.getAggregation("tiles");

//First Tile var oApproveTile = oTiles[0].getId(); sap.ui.getCore().byId(oApproveTile).attachPress

( function() {

name="157";

alert(name);

var oRouter = sap.ui.core.UIComponent.getRouterFor(oController); this.oRouter.navTo("secondscreen",{name: name}); }); }

Till alert , the code is working fine , but after that i m getting navTo undefined error.

Please suggest.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Jul 20, 2017 at 10:25 AM

    HI Lalitha -

    this is where you can find the router documentation

    https://sapui5.hana.ondemand.com/explored.html#/sample/sap.ui.core.sample.RoutingFullscreen/code

    the question should be whether or not your views are defined ? if so, then make sure your view names are set up correctly.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 20, 2017 at 10:25 AM

    HI Lalitha -

    this is where you can find the router documentation

    https://sapui5.hana.ondemand.com/explored.html#/sample/sap.ui.core.sample.RoutingFullscreen/code

    the question should be whether or not your views are defined ? if so, then make sure your view names are set up correctly.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 21, 2017 at 09:11 AM

    Hi Sergio,

    Thanks for the response.

    I tried the usual routing code, it doesn't work for me when i try to navigate to another view by clicking on tile .Please suggest .

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 23 at 10:51 AM

    Replace below routing code:

    this.getOwnerComponent().getRouter().navTo("secondscreen",{name: name}); 

    with:

    var oRouter = sap.ui.core.UIComponent.getRouterFor(oController); 
    this.oRouter.navTo("secondscreen",{name: name}); 

    Regards,

    Gururaj

    Add comment
    10|10000 characters needed characters exceeded