admin管理员组文章数量:1023564
I have developed a SAPUI5 master detail app. When I'm clicking on a master item, the corresponding detail page is shown (so far so good). The problem now is, that if I hit refresh (F5) in the browser, the last selected item is loaded (because of the URL parameter).
What I want to achieve is, to display the master list, but no item is selected. Instead a "select an item" page should be shown instead of the item detail page. I've tried many things such as manipulate the routing, but none of this works. Any ideas on how to achieve this?
I have developed a SAPUI5 master detail app. When I'm clicking on a master item, the corresponding detail page is shown (so far so good). The problem now is, that if I hit refresh (F5) in the browser, the last selected item is loaded (because of the URL parameter).
What I want to achieve is, to display the master list, but no item is selected. Instead a "select an item" page should be shown instead of the item detail page. I've tried many things such as manipulate the routing, but none of this works. Any ideas on how to achieve this?
Share Improve this question edited Jan 19, 2018 at 14:16 cschuff 5,5427 gold badges37 silver badges52 bronze badges asked Jan 19, 2018 at 10:38 Thomas L.Thomas L. 2492 silver badges15 bronze badges1 Answer
Reset to default 4By doing that you give up the whole idea of deep-linking which is imho one of the major benefits of the routing. So think twice before doing so.
Anyways you could just reset the hash before initializing the router in your Component like this:
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/core/routing/HashChanger"
], function (UIComponent, HashChanger) {
"use strict";
return UIComponent.extend("sap.ui.demo.nav.Component", {
metadata: {
manifest: "json"
},
init: function () {
// reset the routing hash
HashChanger.getInstance().replaceHash("");
// call the init function of the parent
UIComponent.prototype.init.apply(this, arguments);
// create the views based on the url/hash
this.getRouter().initialize();
}
});
});
BR Chris
I have developed a SAPUI5 master detail app. When I'm clicking on a master item, the corresponding detail page is shown (so far so good). The problem now is, that if I hit refresh (F5) in the browser, the last selected item is loaded (because of the URL parameter).
What I want to achieve is, to display the master list, but no item is selected. Instead a "select an item" page should be shown instead of the item detail page. I've tried many things such as manipulate the routing, but none of this works. Any ideas on how to achieve this?
I have developed a SAPUI5 master detail app. When I'm clicking on a master item, the corresponding detail page is shown (so far so good). The problem now is, that if I hit refresh (F5) in the browser, the last selected item is loaded (because of the URL parameter).
What I want to achieve is, to display the master list, but no item is selected. Instead a "select an item" page should be shown instead of the item detail page. I've tried many things such as manipulate the routing, but none of this works. Any ideas on how to achieve this?
Share Improve this question edited Jan 19, 2018 at 14:16 cschuff 5,5427 gold badges37 silver badges52 bronze badges asked Jan 19, 2018 at 10:38 Thomas L.Thomas L. 2492 silver badges15 bronze badges1 Answer
Reset to default 4By doing that you give up the whole idea of deep-linking which is imho one of the major benefits of the routing. So think twice before doing so.
Anyways you could just reset the hash before initializing the router in your Component like this:
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/core/routing/HashChanger"
], function (UIComponent, HashChanger) {
"use strict";
return UIComponent.extend("sap.ui.demo.nav.Component", {
metadata: {
manifest: "json"
},
init: function () {
// reset the routing hash
HashChanger.getInstance().replaceHash("");
// call the init function of the parent
UIComponent.prototype.init.apply(this, arguments);
// create the views based on the url/hash
this.getRouter().initialize();
}
});
});
BR Chris
本文标签: javascriptSAPUI5 routing reset after browser refreshStack Overflow
版权声明:本文标题:javascript - SAPUI5 routing reset after browser refresh - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745530606a2154730.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论