Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Nov 03, 2015 at 02:19 PM

    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)

    Add comment
    10|10000 characters needed characters exceeded