Skip to Content
0
Former Member
May 16, 2016 at 08:49 PM

when i'm using router, I have Error ("Can't read property 'navTo' of undefined )

171 Views

I want to move page when i succeed to check login information. However it didn't work

below is my code.

oModel.read("/LOGIN_INFOSet(USRID='"+USRID+"',PASWD='"+PASWD+"')",null,null,false,

function(oData,repsonse){

oJsonModel.setData(oData);

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

currentView : this.getView()

}, true);

},

function(oError){

alert("Invalid Login Info. Please Check User ID and Password")

}

);

When i tried navTo code outside of function, it work.. see below

oModel.read("/LOGIN_INFOSet(USRID='"+USRID+"',PASWD='"+PASWD+"')",null,null,false,

function(oData,repsonse){

oJsonModel.setData(oData);

},

function(oError){

alert("Invalid Login Info. Please Check User ID and Password")

}

);

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

currentView : this.getView()

}, true);

I want to use navigation code inside of success function. DO you guys have any Idea