PDA

View Full Version : Error occuring while removing items from carousel component!!!



pm.sreejith
16 Nov 2011, 4:20 AM
Hi All,

While removing all items from carousel component using the function removeAll(), and trying to add items using the function setItems(). That time I'm getting an error as follows,

Uncaught TypeError: Cannot call method 'createChild' of null:-?



articleCatWise = this.getArticleCategoryWiseStore();
articleCatWise.removeAll();
articleCatWise.clearFilter();
articleCatWise.filter([{
property: 'catId',
value: iCatId
}]);

articleCatWise.load({
scope : this,
callback: function(records, operation, success) {

var arrArticleItems = new Array();
var carouselItems = new Array();
var carouselSubItems = new Array();
var iCnt = 0;

//arrArticleItems.push({});

//the operation object contains all of the details of the load operation
articleCatWise.each(function(rec){

carouselSubItems = new Array(rec.get('articleid'),rec.get('articletitle'),rec.get('articledate'),rec.get('articleshortdesc'),rec.get('articleimg'));
carouselItems.push(carouselSubItems);
iCnt++;

});

var iarrLen = iCnt;
var iMLp = 1;
var iSubLp = 1;
iCnt = 0;

if(iarrLen > 0){

for(iLp = 0; iLp < iarrLen; iLp++){

var articleItems1 = new Array();
var articleItems2 = new Array();

if(iMLp == 1){

if(carouselItems[iLp] != undefined){
articleItems1.push({
html: '<div><div><img src="'+ carouselItems[iLp][4] +'" border="0" /></div><div>'+ carouselItems[iLp][2] +'<br/>'+ carouselItems[iLp][1] +'<br/>'+ carouselItems[iLp][3] +'</div></div>',
flex: 1
});
}

if(carouselItems[iLp+1] != undefined){
articleItems2.push({
html: '<div><div><img src="'+ carouselItems[iLp+1][4] +'" border="0" /></div><div>'+ carouselItems[iLp+1][2] +'<br/>'+ carouselItems[iLp+1][1] +'<br/>'+ carouselItems[iLp+1][3] +'</div></div>',
flex: 1
});
}

if(carouselItems[iLp+2] != undefined){
articleItems2.push({
html: '<div><div><img src="'+ carouselItems[iLp+2][4] +'" border="0" /></div><div>'+ carouselItems[iLp+2][2] +'<br/>'+ carouselItems[iLp+2][1] +'<br/>'+ carouselItems[iLp+2][3] +'</div></div>',
flex: 1
});
}

if(carouselItems[iLp+3] != undefined){
articleItems2.push({
html: '<div><div><img src="'+ carouselItems[iLp+3][4] +'" border="0" /></div><div>'+ carouselItems[iLp+3][2] +'<br/>'+ carouselItems[iLp+3][1] +'<br/>'+ carouselItems[iLp+3][3] +'</div></div>',
flex: 1
});
}

arrArticleItems.push({
xtype: 'container',
layout: {
type: 'hbox'
},
items: [
{
html: '<div><div style="border:1px solid red;"><img src="'+ carouselItems[iLp][4] +'" border="0" /></div><div>'+ carouselItems[iLp][2] +'<br/>'+ carouselItems[iLp][1] +'<br/>'+ carouselItems[iLp][3] +'</div></div>',
flex: 1
},
{
xtype: 'container',
layout: {
type: 'vbox'
},
items: articleItems2
}
]
});

iLp = iLp + 3;

}
else{

//First Array
if(carouselItems[iLp] != undefined){
articleItems1.push({
html: '<div><div><img src="'+ carouselItems[iLp][4] +'" border="0" /></div><div>'+ carouselItems[iLp][2] +'<br/>'+ carouselItems[iLp][1] +'<br/>'+ carouselItems[iLp][3] +'</div></div>',
flex: 1
});
}

if(carouselItems[iLp+1] != undefined){
articleItems1.push({
html: '<div><div><img src="'+ carouselItems[iLp+1][4] +'" border="0" /></div><div>'+ carouselItems[iLp+1][2] +'<br/>'+ carouselItems[iLp+1][1] +'<br/>'+ carouselItems[iLp+1][3] +'</div></div>',
flex: 1
});
}

if(carouselItems[iLp+2] != undefined){
articleItems1.push({
html: '<div><div><img src="'+ carouselItems[iLp+2][4] +'" border="0" /></div><div>'+ carouselItems[iLp+2][2] +'<br/>'+ carouselItems[iLp+2][1] +'<br/>'+ carouselItems[iLp+2][3] +'</div></div>',
flex: 1
});
}


//Second Array
if(carouselItems[iLp+3] != undefined){
articleItems2.push({
html: '<div><div><img src="'+ carouselItems[iLp+3][4] +'" border="0" /></div><div>'+ carouselItems[iLp+3][2] +'<br/>'+ carouselItems[iLp+3][1] +'<br/>'+ carouselItems[iLp+3][3] +'</div></div>',
flex: 1
});
}

if(carouselItems[iLp+4] != undefined){
articleItems2.push({
html: '<div><div><img src="'+ carouselItems[iLp+4][4] +'" border="0" /></div><div>'+ carouselItems[iLp+4][2] +'<br/>'+ carouselItems[iLp+4][1] +'<br/>'+ carouselItems[iLp+4][3] +'</div></div>',
flex: 1
});
}

if(carouselItems[iLp+5] != undefined){
articleItems2.push({
html: '<div><div><img src="'+ carouselItems[iLp+5][4] +'" border="0" /></div><div>'+ carouselItems[iLp+5][2] +'<br/>'+ carouselItems[iLp+5][1] +'<br/>'+ carouselItems[iLp+5][3] +'</div></div>',
flex: 1
});
}


arrArticleItems.push({

xtype: 'container',
layout: {
type: 'hbox'
},

items: [
{
xtype: 'container',
layout: {
type: 'vbox'
},
items: articleItems1
},
{
xtype: 'container',
layout: {
type: 'vbox'
},
items: articleItems2
}
]

});

iLp = iLp + 5;
}

iMLp++;
}

this.getContentCarousel().removeAll();
this.getContentCarousel().setItems(arrArticleItems);

}

}
});


I'm using sencha touch 2.0 pr2 version with MVC pattern.
Please go through the code and let me know.

Any help would be greatly appreciated...:)

mitchellsimoens
17 Nov 2011, 11:01 AM
This is a bug and is known.

Sewdn
16 Jan 2012, 1:48 AM
Any idea when this bug wil be fixed?

thanks!
Pieter

jamezilla
17 Apr 2012, 9:54 AM
I'm still seeing this bug in 2.0.1rc. Is there a way to monitor bugs? Bug tracker somewhere? If so, what's the bug #?