Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Carousel with pages binding

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

Former Member
Former Member replied

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)

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question