PDA

View Full Version : Swap out images in a Carousel?



mcg1103
26 Nov 2019, 5:55 AM
When using a Carousel if you want to completely change the images do you have to destroy the Carousel and create a new object or can you just change out the Images. I have not had any luck doing this as doing a remove on any image items on the carousel object throws an exception.

Just calling carousel.remove(item);



Decorator.js?_dc=1574776392291:128 Uncaught TypeError: Cannot set property 'ownerCmp' of null
at constructor.applyComponent (Decorator.js?_dc=1574776392291:128)
at constructor.setter [as setComponent] (Config.js?_dc=1574776392288:324)
at constructor.onItemRemove (Carousel.js?_dc=1574776392287:248)
at constructor.doRemove (Container.js?_dc=1574776392287:998)
at constructor.remove (Container.js?_dc=1574776392287:966)
at ViewItem.js?_dc=1574776392287:85
at Array.forEach (<anonymous>)
at constructor.get (ViewItem.js?_dc=1574776392287:83)
at constructor.react (Formula.js?_dc=1574776392289:370)
at constructor.notify (Scheduler.js?_dc=1574776392289:424)

Thanks.
Mark

daniel.gallo
26 Nov 2019, 10:09 AM
Hi Mark,

It looks like we have this as an open issue in our system (EXTJS-26818), and there is an override that can be used in the meantime to workaround the problem:



Ext.define('Overrides.Decorator', {
override: 'Ext.Decorator',

applyComponent: function(config) {
var result = Ext.factory(config);

if (result) {
result.ownerCmp = this;
}

return result;
}
});


Thanks,

Dan