我试图在我的移动应用程序.But中实现拆分应用程序功能,在导航到Detail2页面后,一个“后退”导航按钮被放入,当按下它时不起作用。
我把我的代码放在下面:(如果你需要更多信息,请返回) view.js文件(内容):
sap.ui.jsview("split_app.first_view", {
getControllerName : function() {
return "split_app.first_view";
},
createContent : function(oController) {
var olist1 = new sap.m.StandardListItem({
type: sap.m.ListType.Active,
title: "to detail 1",
tap: function(){
osplit.toDetail("detail1");
}
});
var olist2 = new sap.m.StandardListItem({
type: sap.m.ListType.Active,
title: "to detail 2",
tap: function(){
osplit.toDetail("detail2");
}
});
var otext = new sap.m.Label({
text: "first label",
});
var osplit = new sap.m.SplitApp("split");
var odetail1 = new sap.m.Page("detail1", {
title: "first details",
content: [
otext
]
});
var odetail2 = new sap.m.Page("detail2",{
title: "second Details",
showNavButton: true,
navButtonPress: function(){
osplit.toMaster("masterPage");
app.back();
},
content: [
new sap.m.Label({
text: "second label"
})
]
});
var omaster1 = new sap.m.Page("masterPage", {
title: "master page",
content:[
new sap.m.List({
items : [ olist1, olist2 ]
}) ]
});
osplit.addMasterPage(omaster1);
osplit.addDetailPage(odetail1).addDetailPage(odetail2);
osplit.setMode("ShowHideMode");
return new sap.m.Page({
title: "Title",
content: [
osplit
]
});
}
发布于 2013-11-22 16:40:29
假设您想要在详细信息区域(右侧)后退一步,您可以在单击back按钮(NavButtonPress)时调用SplitApp对象的backDetail()函数:
osplit.backDetail();
同样的功能也适用于Master Area (左侧)中的向后导航:
osplit.backMaster();
如果你想在你的应用程序对象中导航,请确保有你来自的前一个页面,并且所有页面对应用程序对象都是已知的(可能在你的index.html文件中):我刚刚测试了你的代码,它让我使用上面提到的函数在SplitApp中导航,并使用以下声明在应用程序中导航回来(在你的索引中或你托管应用程序对象的任何地方):
var app = new sap.m.App();
var init = sap.ui.view({
id : "idinit",
viewName : "stackovertest.init",
type : sap.ui.core.mvc.ViewType.JS
})
var page = sap.ui.view({
id : "idsplit_app1",
viewName : "stackovertest.split_app",
type : sap.ui.core.mvc.ViewType.JS
});
app.addPage(init);
app.addPage(page);
从init页面进入后,您可以使用
app.back();
希望这能对你有所帮助。
https://stackoverflow.com/questions/18605611
复制相似问题