cancel
Showing results for 
Search instead for 
Did you mean: 

Carousel with pages binding

Former Member
0 Kudos

Hi,

Is it possible to bind the sap.m.Carousel control with a list? So bind an aggregation of pages using any control (except complex controls) as template.

I tried something myself, but it doesn't work. Any help, examples are welcome

Thanks,

Robbe Wuyts

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi!

var oCarousel = new sap.m.Carousel({
           loop : true
         });

var oModel = new sap.ui.model.json.JSONModel(oController.getCategoryList().d);//sync


         oController.getCategoryList().d.results.forEach(function(category) {
           if (category.CATEGORY_ID) {
             oCarousel.addPage(new sap.m.Page({ title: category.title)

          }

});


or

var oPage = new sap.m.Page({ title: "{title}"

oCarousel.bindAggregation("pages", "/", oPage"}));

oCarousel.setModel(yourModel);


PS: instead sap.m.Page you can use any element, perfect way this create separate views and add to carousel

var page = new sap.ui.core.mvc.JSView({
         id : Id,
         viewName : "name.view." + pageId
       });

oCarousel.addPage(page)

Answers (0)