I would like to reload items in the carousel onPainted()
method. So whenever users come the carousel item then we have a fresh list of carousel items. Problem at this point of time (please have a look at the source code), the carousel reloads items, however until I touch the carousel, the first carousel item is blank (or not selected) and no items selected. I would like at least to see the first element to be selected.
So here is the simplified source code:
Ext.define("APN.view.FeaturedCarousel", { config: { listeners: { painted: function(carousel, eOpts) { var features_url = Ext.getStore("regionalisation").getRegionalisedMenus().feature.url; this.setCarouselStore(features_url); } } }, initialize: function () { this.callParent(); var me = this; var features_url = Ext.getStore("regionalisation").getRegionalisedMenus().feature.url; this.setCarouselStore(features_url); }, setCarouselStore: function (features_url) { var me = this; Ext.Ajax.request({ url: features_url, success: function (response) { me.removeAll(); if (!xml) return; var store = Ext.create('Ext.data.Store', { autoLoad: true, fields: [ ], data: xml, proxy: { type: 'memory', reader: { type: 'xml', rootProperty: 'xml', record: 'item' } } }); store.each(function (record) { var item = Ext.create("Ext.Container", { html: "some HTML HERE" }); me.add(item); }); } }); } });