Note that there are some explanatory texts on larger screens.

plurals
  1. POsencha touch carousel not removing all items
    text
    copied!<p>Baffled by this and not sure where to start looking.</p> <p>I have a carousel which I load when the refresh event fires on my backing store:</p> <pre><code> Ext.define('Rb.store.Items', { extend: 'Ext.data.Store', requires: ['Rb.model.Item', 'Ext.data.proxy.Rest'], config: { storeId: 'itemstore', model: 'Rb.model.Item', proxy: { type: 'rest', url: '', reader: { type: 'json', rootProperty: 'items' } }, autoLoad: false, listeners:{ refresh: function( me, data, eOpts ){ console.log("refresh"); var carousel = Ext.ComponentQuery.query('rbdetailcarousel')[0]; carousel.removeAll(true); console.log(carousel.getItems().getCount()); data.each(function(rec){ console.log(rec.data); var rdcp = Ext.create('Rb.view.RbDetailCarouselPanel',{ cur_item: rec.data, style: 'background-image:url(resources/startup/320x460.jpg);background-repeat:no-repeat;', }); rdcp.items.get(1).setHtml(rec.data.name); carousel.setActiveItem(rdcp); }); carousel.setActiveItem(0); } } } }); </code></pre> <p>My carousel is super simple:</p> <pre><code> Ext.define('Rb.view.RbDetailCarousel', { extend: 'Ext.Carousel', xtype: 'rbdetailcarousel', config: { itemId: 'rbdetailcarousel', } }); </code></pre> <p>There are two things that are happening here that are strange:</p> <ol> <li><p>When I call carousel.getItems().getCount(), right after the carousel.removeAll(true), I always get a return value of 1. If I inspect the carousel, there is still one item left in the carousel (it looks like it's the indicator??).</p></li> <li><p>When I reload the store, it clears out all the items <em>except</em> the first one, so that as I refresh more and more I get repeats of the first item, then the remaining items added to the end. It seems as if the removeAll(true) is not removing that first item.</p></li> </ol> <p>Any ideas on where I can look to solve this? I have a suspicion that I'm not grabbing the reference to the carousel correctly, because I shouldn't be getting back the indicator as one of the items in it, right?</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload