PDA

View Full Version : add dynamic items to a carousel



samlinux
30 Dec 2011, 7:24 AM
I receive the following error

INVALID_NODE_TYPE_ERR: DOM Range Exception 2

if I try to add more than one elements to a carousel.
I use the following code into my controller



var test = [
{html: 'Tester 1', cls:'cards card1'},
{html: 'Tester 2', cls:'cards card1'}
];

MVC_TWEET.stores.StoreCarousel.load({
method: 'get',
scope: this,
callback: function (records,operation,success){
//Ext.getCmp("carousel").removeAll(false);

for(var i = 0;i<records.length;i++){
console.log(records[i].data.html);
}
Ext.getCmp("carousel").add(test);
Ext.getCmp("carousel").doLayout();
}
});


Thanks for any notes.

mitchellsimoens
30 Dec 2011, 7:54 AM
This is working for me:


var car = new Ext.Carousel({
fullscreen : true,
items : [
{
html : 'One'
},
{
html : 'Two'
}
]
});

car.add([
{
html : 'Three'
},
{
html : 'Four'
}
]);
car.doLayout();

samlinux
30 Dec 2011, 8:07 AM
Thanks for your answer,

but it only works if I use only one element !!!

Ext.getCmp("MyCarousel").add([{html:'hallo'},{html:'html 333'}]);

Is there anything I have to be extra carefully??

samlinux
31 Dec 2011, 1:48 AM
@mitchellsimoens

you are right, now it's working also for me!

My Problem was on an other part of my application. I called on the wrong position the updateWithRecord function and this caused my error.