Menu

Issues with remove and add

Babar
2013-03-19
2013-03-22
  • Babar

    Babar - 2013-03-19

    I came across issues where I had to remove a panel that contains the uploader and add again it again. It appears that swfUpload.destroy() method does not remove the object element from the DOM. As the object is created on onLoad(). Each time container is added to dom tree, its called and hence a new object element is created. Same is the case with html5 label. So I had to modify it onUnload() as follows

    protected void onUnload() {
        if (swfUpload != null) {
            nativeSWFUploadDestroy(swfUpload);
            ObjectElement oe = findObjectElement();
            if(oe != null){
                oe.removeFromParent();
            }
            swfUpload = null;
        }else{
            remove(button);
            remove(fileUpload);
    
            button = null;
            fileUpload = null;
        }
        buttonTextStyleElement = null;
        buttonTextElement = null;
        buttonImageElement = null;
    }
    
     
  • Shawn Quinn

    Shawn Quinn - 2013-03-22

    Thanks for this! Agreed that this logic should be improved. Can you attach a more complete version of the "Uploader.java" file that you're using? Looks like you've made some other changes in order to support this new onUnload() method, so I'd like to take a look at the whole thing - and then I can merge the appropriate changes into the repository so that this enhancement is included in the next release.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.