PDA

View Full Version : Adding items dynamically into a carousel throws an error



Chirieac
17 Jun 2011, 4:51 AM
Hi!

I try to add dynamically some items to an extended carousel component like this:


addImage: function(imageUrl)
{
this.add({html: '<p>test</p>'});
this.doLayout();
},The first time when I call that function the item it's added.
The second time I get this error:
Uncaught Error: INVALID_NODE_TYPE_ERR: DOM Range Exception 2
at sencha-touch-debug.js:13131

If I extend my component from a Panel I don't get this error, I get it only when I extend a Carousel.

How should I add items to a carousel without getting errors?

Chirieac
18 Jun 2011, 3:14 AM
I've finally found the problem:
This I was doing in the initComponent function:

if ( ! this.items)
{
this.html = '<p class="emptyText"><span>'+ this.emptyText +'</span></p>';
}
and after replaced that with:

if ( ! this.items)
{
this.items = [{html: '<p class="emptyText"><span>'+ this.emptyText +'</span></p>'}];
}it worked.