PDA

View Full Version : Wrong number of cards in carousel



rekam
11 Nov 2010, 3:27 AM
hi all!

I just found something weird, but not sure this is a bug or not. Here is the problem:

I have a carousel with 2 items. In the first one, I add a new Panel component after render of the carousel. The thing is, when I add it, it add a new "dot" at the bottom of the carousel.So now the UI makes me think there're 3 cards, but there're still 2, one of them having one "sub-item".

Here is the code to reproduce that stuff:


Ext.setup({
onReady: function() {
// Create a Carousel
var carousel = new Ext.Carousel({
fullscreen: true,
items: [{
title: 'Tab 1'
},{
title: 'Tab 2',
html: 'Some text'
}],
listeners: {
afterrender: function(cmp){
alert('Look, 2 cards!');
var first_card_cmp = cmp.getComponent(0);
first_card_cmp.add({
xtype: 'panel',
title: 'Just a test',
html: 'So why UI says 3 cards in carousel now?'
});
first_card_cmp.doLayout();
}
}
});
}
});


I tried to comment doLayout(). In that case, the new Panel doesn't render, but the UI said "3 cards" still.

Any suggestions? It seems related to this bug : http://www.sencha.com/forum/showthread.php?114975-OPEN-528-Carousel-Indicator-issue-in-version-0.99&highlight=carousel+add

Thanks!