Detect when the multiupload primefaces componet ends all the uploads

若如初见. 提交于 2019-12-24 03:04:08

问题


I´m usig the jsf version 2.1 primefaces 5.1 and tomcat 7.

I have to execute a managed bean method after the all the uploads has been succesfully in a multiple upload component, I used the onComplete atribute, but is executed after each upload. I need to do it after the all files upload was completed. How identify that?

Thanks in advance for your time and answers

PD I posted this question in the primefaces 1 forum but nobody answer.


回答1:


This should work:

<p:fileUpload ... oncomplete="doSomething(this);" />
<p:remoteCommand name="rc" actionListener="#{bean.method}" />

and

<script>
    function doSomething(fileupload) {
        if (fileupload.files.length == 0) {
            rc();
        }
    }    
</script>

On the bean:

public void method() {
    // Do something here
}


来源:https://stackoverflow.com/questions/26551669/detect-when-the-multiupload-primefaces-componet-ends-all-the-uploads

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!