PDA

View Full Version : How to render an image dynamically?



talha06
11 Nov 2012, 5:28 AM
Hello everyone,

I need to re-render an image (Ext.Image) after some events.
I found `doComponentLayout` function but it didn't work for me unfortunately.


How can I re-render an image which is an item of form?

Thanks in advance..

skirtle
11 Nov 2012, 10:01 PM
What do you mean by 're-render'?

talha06
11 Nov 2012, 11:11 PM
@skirtle
I mean refreshing the image on demand after its first render

sword-it
11 Nov 2012, 11:24 PM
Hi talha06,

FormPanel class have doLayout() method, call this method when you want to see changes. like-


yourFormPanel.doLayout();

talha06
11 Nov 2012, 11:26 PM
@sword-it
actually I've already tried it; but unfortunately it didn't work too..

skirtle
12 Nov 2012, 3:49 AM
I mean refreshing the image on demand after its first render

I'm still pretty unclear what the question is here. For example, you might mean...


Load a different image URL.
Reload the same image URL but a different image.
Resize the image component.


To load a new image just use setSrc. To reload the same image the easiest way is to append a dummy parameter onto the URL.

talha06
12 Nov 2012, 2:11 PM
I'm still pretty unclear what the question is here. For example, you might mean...
Load a different image URL.
Reload the same image URL but a different image.
Resize the image component.
To load a new image just use setSrc. To reload the same image the easiest way is to append a dummy parameter onto the URL.
thanks for your help, by the way it's not necessary to change src. it's enough to call setSrc method to refresh image.

img.setSrc(img.src);

But I think this should come by framework, a method like refresh can be a lot more suitable solution.

Thanks everyone for care.