on 12-31-2013 6:09 AM
Hi,
I want to display charts one by one in one page without clicking any button.
For that I used Navigation bar to display headings of that charts.
In that I used setInterval function to navigate to another item without clicking on that .Then I am getting id of that selected Item and navigate to already existing views based on that selected Item using below code in onInit function.
onInit: function(oevent) {
var oShell = sap.ui.getCore().byId("myShell");
var length = oShell.mAggregations.worksetItems.length;
var i = 0;
var id = setInterval(function() {
if(i >= length)
{
i=0;
}
oShell.setSelectedWorksetItem('__item'+i);
var selectedId = oShell.getSelectedWorksetItem();
var view = new sap.ui.view({
viewName : "chart_nav_bar.chart"+i,
type : "JS"
});
oShell.setContent(view);
i++;
}, 3000);
},
My project Structure is like below.
But the Problem is I am not getting any content . I am getting only title of that particular views like below.
In that image I am navigating to chart0.js file. In that I am having simple button with title chart0. But I am getting only Title without button.
I followed below URL to add the view as content to the Shell dynamically.
I already applied this.setHeight("100%"); .Still I am facing same issue.
Please help me to solve this Issue.
Thanks&Regards
Sridevi
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you rerender the shell after adding the view?
after oShell.setContent(view);
add, oShell.rerender();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for the reply. Still I am facing same issue.
My Project Structure is like below.
index.html
navbar.view.js
navbar.controller.js
And I have another views like chart0,chart1,chart2,chart3. All those view are having simple data like titile and Button .For example chart0 code is like below.
chart0.view.js
When I run this chart0.view.js file individually then I am getting Button with Title.But when I am adding this to the Shell then I am getting only Title .
I have title names chart0,chart1,chart2,chart3 for the remaining views with dummy content.
I can navigate to every view for every 3000 sec.But in every view I am getting only Title like chart0, chart1,chart2,chart3 but not content .
Please go through that code once and suggest me where I have done mistake.
Thanks&Regards
Sridevi
Hi,
I tried all the above solutions to get the charts one by one in Navigation bar with some time Interval without clicking any button.
I can navigate to every view for every 3 seconds. Still I am getting same problem that only page title of every view is displayed without content.
I don't know where I am doing mistake in my code.
Please help.
Thanks&Regards
Sridevi
NO Body
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe the problem is that views are already created. Try this code:
onInit: function(oevent) {
var oShell = sap.ui.getCore().byId("myShell");
var length = oShell.mAggregations.worksetItems.length;
var i = 0;
var id = setInterval(function() {
if(i >= length) i=0;
oShell.setSelectedWorksetItem('__item'+i);
var selectedId = oShell.getSelectedWorksetItem();
if (sap.ui.getCore().byId("chart_nav_bar.chart"+i) != undefined){
sap.ui.getCore().byId("chart_nav_bar.chart"+i).destroy();
var view = sap.ui.view( {
id : "chart_nav_bar.chart"+i,
viewName : "view." + viewId, //Assuming your views are saved in view package
type : sap.ui.core.mvc.ViewType.JS
});
oShell.setContent(view);
} else {
var view = sap.ui.view( {
id : "chart_nav_bar.chart"+i,
viewName : "view." + viewId, //Assuming your views are saved in view package
type : sap.ui.core.mvc.ViewType.JS
});
oShell.setContent(view);
}
i++;
}, 3000);
},
Kind regards!
Hi,
I am sorry.That's not my quession.
viewName : "view." + viewId,
In above sentence viewId means view name or id of that view.
Below is my chart0.view.js
sap.ui.jsview("chart_nav_bar.chart0", {
getControllerName : function() {
return "chart_nav_bar.chart0";
},
createContent : function(oController) {
var button0 = new sap.m.Button({
text : "Sample Button"
});
return new sap.m.Page("chart0",{
title: "Chart0",
content: [button0]
});
}
});
I changed my code like below in navbar.controller.js
if (sap.ui.getCore().byId("chart"+i) != undefined){
sap.ui.getCore().byId("chart"+i).destroy();
var view = sap.ui.view( {
id : "chart_nav_bar.chart"+i,
viewName : "chart_nav_bar.chart"+i ,
type : sap.ui.core.mvc.ViewType.JS
});
oShell.setContent(view);
}else{
var view = sap.ui.view( {
id : "chart_nav_bar.chart"+i,
viewName : "chart_nav_bar.chart"+i ,
type : sap.ui.core.mvc.ViewType.JS
});
oShell.setContent(view);
}
My view names are chart0, chart1, chart2. I want to get all these charts in that shell. My shell is in navbar.view.js file.Here, I am getting chart view names dynamically
Still I am facing same issue.I am getting only title chart0 without button. Even when I check the code in developer tools I am getting only title of that page.
If I run that views individually it's working fine and getting button also.When I add that content to the shell then only I am facing this issue. I am in confusion where I have done mistake.
Is there any wrong in my code?
Please help me.
Thanks&Regards
Sridevi
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.