on 05-16-2016 9:49 PM
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
again "this" issue.
just remember this inside of the nested function is not the this you want.....
var that=this;
oModel.read("/LOGIN_INFOSet(USRID='"+USRID+"',PASWD='"+PASWD+"')",null,null,false,
function(oData,repsonse){
oJsonModel.setData(oData);
sap.ui.core.UIComponent.getRouterFor(that).navTo("Master" ,{
currentView : this.getView()
}, true);
},
function(oError){
alert("Invalid Login Info. Please Check User ID and Password")
}
);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);
}.bind(this), //this should also work
function(oError){
alert("Invalid Login Info. Please Check User ID and Password")
}
);
Just as an alternative you can use:
jQuery.proxy(function(oData, oResponse){
oJsonModel.setData(oData);
sap.ui.core.UIComponent.getRouterFor(this).navTo("Master" ,{
currentView : this.getView()
}, true);
},this),
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.