cancel
Showing results for 
Search instead for 
Did you mean: 

Router.navTo doesn't trigger a change...

Former Member
0 Kudos

Hello Experts,

im using the Router-Mechanism in my Application. But when i use the "navTo"-Method of the router, my Splitapp adds the Detail-Page into the aggregation detailPages, but doesn't set the new detail page as current page.

My Question is now how is this possible?

See my routing configuration and how i implement the routing below:


routing     : {

            config: {

                routerClass      : mibs_portal.Router,

                viewType         : "XML",

                viewPath         : "mibs_portal.view",

                targetAggregation: "content",

                targetControl   : "Mobile--myShell",

                clearTarget      : false

            },

            routes: [

                {

                    pattern           : ["", "main"],

                    name              : "navMain",

                    view              : "Main"

                },

                {

      pattern    : "timesheet",

  name              : "navTimesheet",

      view              : "Timesheet",

      subroutes         : [

  {

                                        pattern  : "timesheet/day/{newDate}",

                                        name     : "navDay",

                                        viewType : "XML",

                                        view     : "Detail",

                                        viewPath : "TimeSheet.view.TimeSheet",

                                        viewId   : "Detail",

                                        targetAggregation : "detailPages",

                                        targetControl  : "v_TimeSheet--TimeSheet_App",

                                        clearTarget       : false

                                  }                                

                          ]

               

  }

               

            ]

        }

And the navTo-Implementation:


sap.ui.core.UIComponent.getRouterFor(sap.ui.getCore().byId("Mobile")).navTo("navDay", {newDate:aSelectedDates[0].getDate() + "-" +

    (aSelectedDates[0].getMonth() + 1) + "-" +

    aSelectedDates[0].getFullYear()}, bReplace);

And the "routePatternMatched"-Method in Detail Controller:


routeMatched : function(oRoute){

  if(oRoute.getParameter("name") === "navDay"){

  var sDate = oRoute.getParameter("arguments").newDate;

  var dateArray = sDate.split("-");

  var aDates = [];

  aDates.push(new Date(parseInt(dateArray[2]), (parseInt(dateArray[1]) - 1), parseInt(dateArray[0]),0,0,0,0));

  sap.ui.getCore().byId("Master--TimeCalendar").removeAllSelectedDates();

  sap.ui.getCore().byId("Master--TimeCalendar").insertSelectedDate(new sap.ui.unified.DateRange({startDate:aDates[0]}), -1);

  this.refresh(aDates);

  }

  },

After using navTo, i reach my "routePatternMatched"-Method in Detail-Controller. Everything works fine there. But on the splitapp the current page is still empty.

Has anyone an idea why?

Thanks for your Help!

Sascha

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Why did you redefine the navTo method?

former_member182372
Active Contributor
0 Kudos

Plunker may be?

Former Member
0 Kudos

Sorry, what do you mean with Plunker?

former_member182372
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi Sascha,

write this event in your detail controller.

this.getView().addEventDelegate({

  onBeforeShow: function(evt) {

rendring code for your UI.

} });