PDA

View Full Version : Carousel dynamically adding cards problem - all about rendering?



Eric Clapton
22 Jul 2011, 12:45 AM
Hello,
I'm trying to implement Sencha Touch Carousel component to my app.
I take photos and show those photos in a carousel.

For instance;I take 2 photos and when app gets back from Camera it shows only the first photo not the second one in carousel.When I try to scroll to next card I see an empty card.

Finally I think my problem is all about rendering.I put doLayout and doComponentLayout everywhere in my code to check if it works but no use.

Any help will be appreciated.Thanks.



this.carousel.removeAll();
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
this.cardItems.push(new Ext.Container({
scroll: 'horizontal',
styleHtmlContent: true,
html: "<center><img src='" + mediaFiles[i].fullPath + "' style='display:block;max- width:90%;min-width:90%;max-height:90%;min-height:90%;'/></center>"
}));
this.carousel.add(this.cardItems);
this.carousel.doLayout();
this.carousel.doComponentLayout();
}

phil.fuse
22 Jul 2011, 1:08 AM
without really looking into to you eg i'm not 100% sure why this doesn't work but you should be able to just call



this.carousel.removeAll(true);// force the destroy
//bla the carditems
this.carousel.update(this.cardItems);

to do this.