Search code examples
javascriptextjsextjs3

Ext JS 3.4 image refresh


I am using Ext JS 3.4 and whenever I open new windows with new source, the image remains the same. I logged src path and it changes every time but I have no clue why it keeps showing me the same image.

I have been looking up for hours but getCmp().getView().refresh() or any functions that seem related to this problem are not included in 3.4 .

var image = new Ext.BoxComponent({
    autoEl: {
        tag: 'img',
        width: 90,
        height: 250,
        src: img_path
    }
});

I made it like this and tried to open it in

new_win = new Ext.Window( ... );

(more specifically in side of vbox). I checked several times the image.autoEl.src has been updated but new_win keeps showing me first image shown before. Can anyone give me the solution or at least any kind of advice?


Solution

  • See if that helps, first, give it an ID to your autoEl

    autoEl: {
        tag: 'img',
        id: 'myImage',
        width: 90,
        height: 250,
        src: img_path
    }
    

    And then use the DOM to change the image

    function setImage(new_image) {
        document.getElementById('myImage').src = new_image;
    }