on 05-09-2017 11:32 AM
i hope you're doing fine.
I am working on a sap fiori app & i am stuck in this problem for about 2 weeks with no result. I have a "create" fragment which is attached to "Detail" view.
When i open the "create" fragment and want to go back to the main detail view, the back button doesn't work therefore i have to refresh the app.
I guess the back button doesn't work the same way between views & between fragments.
Here's my back button function :
cancel: function() {
var oHistory = sap.ui.core.routing.History.getInstance(),
sPreviousHash = oHistory.getPreviousHash();
if (sPreviousHash !== undefined) {
// The history contains a previous entry
history.go(-1);
}
},
here when i display sPreviousHash, it's undefined.
Any help would be much appreciated.
You basically need an Else condition here to navigate in case sPreviousHash is initial.
Replace "master" in the below code with the route where you want to navigate to.
if (sPreviousHash !== undefined) {
// The history contains a previous entry
history.go(-1);
} else {
// Otherwise we go backwards with a forward history
var bReplace = true;
this.getRouter().navTo("master", {}, bReplace);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.