PDA

View Full Version : Image setSrc() does not update image.



xjscrafter
14 Jan 2014, 7:22 PM
I have code that sets the src of an ExtJS 4 Image component.


me.cpuChart.setSrc(cpuChartUrl);




- set src first time - works fine
- set src to a different url - works fine
- set src back to the first url - DOES NOT UPDATE IMAGE

I tried calling these methods after calling setSrc() but does not update:

me.cpuChart.doComponentLayout();
me.cpuChart.updateLayout();

Any ideas? Seems like first url is being cached.

xjscrafter
14 Jan 2014, 9:41 PM
Solved.

I append cache-buster unique number at end of url:


chartUrl += '&' + new Date().getTime();

Gary Schlosberg
15 Jan 2014, 5:49 AM
Glad to hear you've gotten it sorted, and thanks for sharing the solution with the community.