Greg Lafrance
Greg Lafrance

Reputation: 809

In ExtJS 4, why does setSrc() not update image

I have code that sets the src of an ExtJS 4 Image component.

me.cpuChart.setSrc(cpuChartUrl);

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.

Upvotes: 2

Views: 1280

Answers (1)

Xelt
Xelt

Reputation: 396

It depends on the browser caching system... You could try to add a random string or query to the url to force the browser to reload the image from the server.

ex.:

cpuChartUrl = cpuChartUrl +'?dc=' + new Date().getTime();
me.cpuChart.setSrc(cpuChartUrl);

Upvotes: 2

Related Questions