This example of dynamically adding items to a carousel works.
name.js (view)
Code:
Ext.define('App.view.name', {
extend: 'Ext.Panel',
xtype: 'carouselView',
requires: [
'Ext.carousel.Carousel'
],
config: {
layout: 'fit',
items: [
{
xtype: 'carousel'
},
{
xtype: 'button',
text: 'add',
action: 'add',
docked: 'bottom'
}
]
}
});
Main.js (controller):
Code:
Ext.define('App.controller.Main', {
extend: 'Ext.app.Controller',
config: {
refs: {
myCarousel: 'carouselView carousel'
},
control: {
'button[action=add]': {
tap: 'handleAddButtonTap'
}
}
},
handleAddButtonTap: function(btn) {
var c = this.getMyCarousel();
c.add({
xtype: 'panel',
html: new Date(),
layout: 'fit'
});
}
});
Try this out and see if it works for you. If not, please describe more about your situation. When does the method that dynamically adds items to the carousel run?
Brice