-->

Clear all elements of a carousel - Sencha

2019-06-24 01:04发布

问题:

Dows anybody knows how to delete all elements on a carousel in sencha???

carousel = new Ext.Carousel({
    fullscreen: true,
    defaults: {
        cls: 'carousel-item'
    },
    items: [{
            id:'tab-1',
            html: '',
            cls: 'card card1'
        },{
            id:'tab-2',
            html: '<p>Clicking on either side of the indicators below</p>',
            cls: 'card card2'
        },{
            id:'tab-3',
            html: 'Card #3',
            cls: 'card card3'
        }]
});

Thanks a lot

回答1:

You can clear all the components inside your carousel with just a line of code:

carousel.removeAll();

Hope this helps.