on 01-14-2015 4:24 AM
Hi all,
How to navigate between pages using NavContainer concept?
Hi Indu,
These links might help you.
Handling Navigation and Lifecycle Events
Thank you.
Regards,
Pruthvi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<!DOCTYPE html>
<html><head>
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<title>test</title>
<script id='sap-ui-bootstrap' type='text/javascript'
src='/sapui5/resources/sap-ui-core.js'
data-sap-ui-theme='sap_bluecrystal'
data-sap-ui-libs='sap.m'></script>
<!-- add 'sap.ui.table' and/or other libraries if required -->
<script>
var oPage1 = new sap.m.Page("page1",{
title: "Page1", // string
showNavButton: false, // boolean
showHeader: true, // boolean
navButtonText: undefined, // string
enableScrolling: true, // boolean
icon: undefined, // sap.ui.core.URI
backgroundDesign: sap.m.PageBackgroundDesign.Standard, // sap.m.PageBackgroundDesign
navButtonType: sap.m.ButtonType.Back, // sap.m.ButtonType, since 1.12
showFooter: true, // boolean, since 1.13.1
tooltip: undefined, // sap.ui.core.TooltipBase
content:[new sap.m.Button({text:"Button in Page 1", press:function(oEvent){
oAppContainer.addPage(oPage2);
oAppContainer.to("page2");
}})]
});
var oPage2 = new sap.m.Page("page2",{
title: "Page2", // string
showNavButton: false, // boolean
showHeader: true, // boolean
navButtonText: undefined, // string
enableScrolling: true, // boolean
icon: undefined, // sap.ui.core.URI
backgroundDesign: sap.m.PageBackgroundDesign.Standard, // sap.m.PageBackgroundDesign
navButtonType: sap.m.ButtonType.Back, // sap.m.ButtonType, since 1.12
showFooter: true, // boolean, since 1.13.1
tooltip: undefined, // sap.ui.core.TooltipBase
content:[new sap.m.Button({text:"Button in Page 2"})]
});
var oAppContainer = new sap.m.App({initialPage : null,
afterNavigate : function (oEvent) {
alert('After Navigate');
}
});
oAppContainer.addPage(oPage1);
oAppContainer.fireAfterNavigate({});
oAppContainer.placeAt('content');
</script>
</head>
<body class='sapUiBody'>
<div id='content'></div>
</body>
</html>
Hi Pruthvi,
I just used NavContainer instead of sap.m.App and after running the code i am not getting any output. Also, checked the browsers console for errors and there were no errors. Can you please assist me on this.
<script>
var oPage1 = new sap.m.Page("page1",{
title: "Page1", // string
showNavButton: false, // boolean
showHeader: true, // boolean
navButtonText: undefined, // string
enableScrolling: true, // boolean
icon: undefined, // sap.ui.core.URI
backgroundDesign: sap.m.PageBackgroundDesign.Standard, // sap.m.PageBackgroundDesign
navButtonType: sap.m.ButtonType.Back, // sap.m.ButtonType, since 1.12
showFooter: true, // boolean, since 1.13.1
tooltip: undefined, // sap.ui.core.TooltipBase
content:[new sap.m.Button({text:"Button in Page 1", press:function(oEvent){
oAppContainer.addPage(oPage2);
oAppContainer.to("page2");
}})]
});
var oPage2 = new sap.m.Page("page2",{
title: "Page2", // string
showNavButton: false, // boolean
showHeader: true, // boolean
navButtonText: undefined, // string
enableScrolling: true, // boolean
icon: undefined, // sap.ui.core.URI
backgroundDesign: sap.m.PageBackgroundDesign.Standard, // sap.m.PageBackgroundDesign
navButtonType: sap.m.ButtonType.Back, // sap.m.ButtonType, since 1.12
showFooter: true, // boolean, since 1.13.1
tooltip: undefined, // sap.ui.core.TooltipBase
content:[new sap.m.Button({text:"Button in Page 2",
press:function(oEvent){
oAppContainer.addPage(oPage1);
oAppContainer.to("page1");
}
})]
});
var oAppContainer = new sap.m.NavContainer({initialPage : null,
afterNavigate : function (oEvent) {
alert('After Navigate');
}
});
oAppContainer.addPage(oPage1);
oAppContainer.fireAfterNavigate({});
oAppContainer.placeAt('content');
</script>
Hi Varun.
Set Height and width that should solve the issue.
Ex :-
<!DOCTYPE html>
<html><head>
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<title>test</title>
<script id='sap-ui-bootstrap' type='text/javascript'
src='/sapui5/resources/sap-ui-core.js'
data-sap-ui-theme='sap_bluecrystal'
data-sap-ui-libs='sap.ui.commons,sap.ui.ux3,sap.m'></script>
<!-- add 'sap.ui.table' and/or other libraries if required -->
<script>
var oPage1 = new sap.m.Page("page1",{
title: "Page1", // string
showNavButton: false, // boolean
showHeader: true, // boolean
navButtonText: undefined, // string
enableScrolling: true, // boolean
icon: undefined, // sap.ui.core.URI
backgroundDesign: sap.m.PageBackgroundDesign.Standard, // sap.m.PageBackgroundDesign
navButtonType: sap.m.ButtonType.Back, // sap.m.ButtonType, since 1.12
showFooter: true, // boolean, since 1.13.1
tooltip: undefined, // sap.ui.core.TooltipBase
content:[new sap.m.Button({text:"Button in Page 1", press:function(oEvent){
oAppContainer.addPage(oPage2);
oAppContainer.to("page2");
}})]
});
var oPage2 = new sap.m.Page("page2",{
title: "Page2", // string
showNavButton: false, // boolean
showHeader: true, // boolean
navButtonText: undefined, // string
enableScrolling: true, // boolean
icon: undefined, // sap.ui.core.URI
backgroundDesign: sap.m.PageBackgroundDesign.Standard, // sap.m.PageBackgroundDesign
navButtonType: sap.m.ButtonType.Back, // sap.m.ButtonType, since 1.12
showFooter: true, // boolean, since 1.13.1
tooltip: undefined, // sap.ui.core.TooltipBase
content:[new sap.m.Button({text:"Button in Page 2",
press:function(oEvent){
oAppContainer.addPage(oPage1);
oAppContainer.to("page1");
}
})]
});
var oAppContainer = new sap.m.NavContainer({initialPage : null,
width :"98%",
height:"16em",
afterNavigate : function (oEvent) {
alert('After Navigate');
}
});
oAppContainer.addPage(oPage1);
oAppContainer.fireAfterNavigate({});
oAppContainer.placeAt('content');
</script>
</head>
<body class='sapUiBody'>
<div id='content'></div>
</body>
</html>
Thank you.
Regards,
Pruthvi.
thank you pruthvi.
Regards
Indrajith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please mark this Discussion with a Correct Answer and Helpful Answer where appropriate. See http://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be.
Regards, Mike
SAP Customer Experience Group - CEG
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.