I'm doing a routing navigation between two views. The first one throw an onClick event function. This functión capture GPS location and when the location callback is executed, (i debuged it on chrome) routing should change to the next view. Routing code is executed, but nothing happeng. There are no errors in the console.
When i execute the Router.navTo outside the callback it work perfectly so routing configuration should be ok.
It 's not possible to do it?
here is my code.
This doesn't work
onBtn: function() {
var that = this;
GPS.getLastLocation(function(location){
sap.ui.getCore().setModel(new sap.ui.model.json.JSONModel(location),"location");
that.getRouter().navTo("show_map");
})
}
This work¡¡
onBtn: function() {
sap.ui.getCore().setModel(new sap.ui.model.json.JSONModel({"latitude":1.15, "longitude": 16.8}),"location"); this.getRouter().navTo("show_map");
}
This also doesn't work.
onBtn: function() {
var that = this;
sap.ui.getCore().setModel(new sap.ui.model.json.JSONModel(location),"location");
setTimeout(function(){
that.getRouter().navTo("show_map");
},200)
}