I have a single page app written in SAPUI5 using JS views. I want to create a "Dashboard" page and put some tiles on it. Therefore I am creating a "sap.m.TileContainer" in the "createContent" function of my view.js-file.
What I need to implement is to have two separate TileConatiner because I have important tiles at the top and less important ones at the bottom. But no matter what I do e.g. putting the two TileContainers in a MatrixLayout, HorizontalLayout or as "content" into a sap.m.page it is no longer shown. One TileContainer is shown when I just return this single instance directly without any componet surrounding it.
Can anyone help me out here please? Following code works fine:
createContent : function(oController) {
var tileContainer = new sap.m.TileContainer({
tiles : [
new sap.m.StandardTile({
icon : "sap-icon://play",
title : "Important Tile",
press : function() {
oController.nav.to("AfoStart");
}
}), new sap.m.StandardTile({
icon : "sap-icon://pause",
title : "ANOTHER Important Tile",
press : function() {
oController.nav.to("AfoStart");
}
}), new sap.m.StandardTile({
icon : "sap-icon://timesheet",
title : "Third important tile",
press : function() {
oController.nav.to("AfoStart");
}
}), new sap.m.StandardTile({
icon : "sap-icon://number-sign",
title : "UNIMPORTANT ONE",
press : function() {
oController.nav.to("AfoStart");
}
}), new sap.m.StandardTile({
icon : "sap-icon://locate-me",
title : "UNIMPORTANT TWO",
press : function() {
oController.nav.to("AfoStart");
}
})
],
});
return tileContainer;
}
This code doesnt work:
createContent : function(oController) {
var tileContainerTop = new sap.m.TileContainer({
tiles : [
new sap.m.StandardTile({
icon : "sap-icon://play",
title : "Important Tile",
press : function() {
oController.nav.to("AfoStart");
}
}), new sap.m.StandardTile({
icon : "sap-icon://pause",
title : "Another important Tile",
press : function() {
oController.nav.to("AfoStart");
}
}), new sap.m.StandardTile({
icon : "sap-icon://timesheet",
title : "Third important tile",
press : function() {
oController.nav.to("AfoStart");
}
}),
],
});
var tileContainerBottom = new sap.m.TileContainer({
tiles : [
new sap.m.StandardTile({
icon : "sap-icon://play",
title : "UNIMPORTANT ONE",
press : function() {
oController.nav.to("AfoStart");
}
}), new sap.m.StandardTile({
icon : "sap-icon://pause",
title : "UNIMPORTANT TWO",
press : function() {
oController.nav.to("AfoStart");
}
})
],
});
var page = new sap.m.Page("myPage", {
title: "Dashboard",
content: [tileContainerTop, tileContainerBottom]
});
// OR create MatrixLayout here...doenst work
// OR create HorizontalLayout here...doesnt work
return page;
}