PDA

View Full Version : dynamic carousel



Perdiga
31 Jan 2012, 10:50 AM
how can i make one carousel dynamic? i am trying do do this



mySlideShowPanel.removeAll(true,false);
for(i = 0 ; i < result.Result.length ; i++ ){
mySlideShowPanel.add([{
xtype: 'image',
cls: 'my-carousel-item-img',
id: 'image'+i,
src: result.Result[i].uri,
nome: result.Result[i].nome,
atual:i+1,
total:result.Result.length,
}])
}

the first time works fine but not the second time



NOT_FOUND_ERR: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist.

rdougan
31 Jan 2012, 11:26 AM
The following code works fine for me:


Ext.setup({
onReady: function() {
c = Ext.Viewport.add({
xtype: 'carousel'
});

c.add({
html: 'one'
});

c.add({
html: '2'
});

c.add({
html: '3'
});
}
});

Perdiga
1 Feb 2012, 9:18 AM
the problem is when i need remove all items ..

rdougan
1 Feb 2012, 12:58 PM
That's a bug, but it is fixed in the next release:


Ext.setup({
onReady: function() {
c = Ext.Viewport.add({
xtype: 'carousel'
});

c.add({
html: 'one'
});

c.add({
html: '2'
});

c.add({
html: '3'
});

setTimeout(function() {
c.removeAll(true, false);

a = c.add({
html: 'a'
});

c.add({
html: 'b'
});

c.add({
html: 'c'
});

c.setActiveItem(a);
}, 500);
}
});