Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Routing and Naivgation issue

$
0
0

Hi All,

I am using master-master details Template to create an app, and I would like to add second detail view.. So enhanced the route as below

 

sap.ui.core.UIComponent.extend("zfin.Component", {

  metadata : {

  name : "TDG Demo App",

  version : "1.0",

  includes : [],

  dependencies : {

  libs : ["sap.m", "sap.ui.layout"],

  components : []

  },

 

 

  rootView : "zfin.view.App",

 

 

  config : {

  resourceBundle : "i18n/messageBundle.properties",

  serviceConfig : {

  name: "Z_FI_VENDOR_INVOICE_DISPLAY_XT_SRV",

  serviceUrl: "/sap/opu/odata/sap/Z_FI_VENDOR_INVOICE_DISPLAY_XT_SRV/"

  }

  },

 

 

  routing : {

  config : {

  routerClass : zfin.MyRouter,

  viewType : "XML",

  viewPath : "zfin.view",

  clearTarget : false,

  transition: "slide"

  },

  routes : [

  {

  pattern : "",

  name : "main",

  view : "Master",

  viewLevel : 1,

  targetAggregation : "masterPages",

  targetControl : "idAppControl",

  subroutes : [

  {

  pattern : "master2/{entity}",

  name : "master2",

  view : "Master2",

        viewLevel : 2,

            targetAggregation : "masterPages"

  }

      ]

  },

  {

  pattern : "master02/{entity}",

  name : "master02",

  view : "Master2",

  viewLevel : 2,

  targetAggregation : "masterPages",

  subroutes : [

  {

  pattern : "master02/{entity}",

  name : "detail",

  view : "Detail",

        viewLevel : 3,

            targetAggregation : "detailPages"

  }

      ]

  },

  // manoj new view.

  {

  pattern : "master02/{entity}",

  name : "detail",

  view : "Detail",

  viewLevel : 3,

  targetAggregation : "masterPages",

  subroutes : [

  {

  pattern : "master02/{entity}",

  name : "detail2",

  view : "Detail2",

        viewLevel : 4,

            targetAggregation : "detailPages"

  }

      ]

  }

  //manoj end of view

     ]

  }

  },

 

Now on the detail1 window, in the onlineitempressed I would like to navigate to next window.

 

onLineItemPressed: function(oEvent) {

   

     alert(" I am clicked" );

   

    // begin of manu 07/20

    // var context = oEvent.getParameter("master2").getBindingContext();

    // var odata = context.getPath();

    // this.oHasher = sap.ui.core.routing.HashChanger.getInstance();

    // console.log(this.oHasher);

    // this.oHasher.setHash(context);

    // var sViewID = this.oHasher.getHash().split("/")[2];

    // this._oRouter.navTo("Detail2",{contextPath:sViewID});

   

    // this._oRouter.navTo("Detail2");

    // console.log ("after navigation"+context);

   

    // end of manu 07/20

    var selected = oEvent.getParameter("key");

    var view = sap.ui.getCore().byId(selected);

    alert(view) ;

   

    // if(view === undefined) {

    //     view  = new sap.ui.view({

    //         id: selected,

    //          viewname: "zfin.view.detail2",

    //          type : sap.ui.core.mvc.ViewType.XML});

        this.getView().getController("zfin.view.detail2");

        this.getView().

  this.getRouter().myNavToWithoutHash({

  currentView : this.getView(),

  targetViewName : "zfin.view.detail2",

  targetViewType : "XML"

  });            

   

 

 

  

   

    // console.log(selected);

//     var bReplace = jQuery.device.is.phone ? false : true;

// this.getRouter().navTo("detail2", {

// from: "Detail",

// entity: oItem.getBindingContext().getPath().substr(1)

// }, bReplace);

 

    //         var bReplace = jQuery.device.is.phone ? false : true;

    // this._oRouter.navTo("detail2", {

    // from: "detail",

    // entity: oEvent.getSource().getBindingContext().getPath().substr(1),

    // tab: null

    // }, bReplace);

   

//     sap.ui.core.UIComponent.getRouterFor(this).navTo("detail2",{

// entity : oEvent.getSource().getBindingContext().getPath().slice(1)

// }, true);

    },

 

 

My Issue is  that I am able to get to the even but unable to naviagte second detail page. I tried multiple ways as you can see in the commented code.

 

Could you please let me know how can I fix this.


Viewing all articles
Browse latest Browse all 6178

Latest Images

Trending Articles



Latest Images