Skip to Content
0
Jan 22, 2014 at 06:42 AM

How to show the views one by one with some Time interval in SAPUi5?

214 Views

Hi,

In my Application I have so many views. In each view we have one chart.

No I want to display these charts one by one with Some time Interval without clicking any button. i.e Navigating from one view to another with some time Interval.

My Project Structure is like below.

I have written the below code in index.html to get the view data one by one .

<script>

sap.ui.localResources("navigation_chart");

var app = new sap.m.App({initialPage:"idchart11"});

var id = setInterval(navigation, 3000);

var i=1;

function navigation(){

var page = sap.ui.view({id:"idchart1"+i, viewName:"navigation_chart.chart"+i, type:sap.ui.core.mvc.ViewType.JS});

app.addPage(page);

console.log(page);

app.placeAt("content", "only");

i++;

if(i > 2){

clearInterval(id);

}

}

</script>

But my problem is in console I am getting views one by one .

But I can show only First chart. Even it goes to the second view (In console I can see the Second view also) it doesn't show the second chart.

It is always showing the first chart.

How to remove first view and add the second view to display charts one by one?

Please help me.

Thanks&Regards

Sridevi

Attachments