2016-05-13 61 views
0

我使用Primefaces 5.3,我想,當我上傳我的文件做一個Ajax調用Primefaces文件上傳 - 哪些事件Ajax調用

<p:fileUpload 
    id="fileUp" 
    fileUploadListener="#{carEditDocumentController.handleFileUpload}" 
    label="#{msg['document.selectDocument']}" 
    auto="true" 
    required="true" 
    requiredMessage="#{msg['error.required']}" 
    mode="advanced" 
    skinSimple="true"          
    update="carDocumentNewName"> 
    <p:ajax listener="#{carEditDocumentController.checkDocument()}" event="???" update="carDocumentError"/> 
</p:fileUpload> 

我需要哪個事件,當我上傳到執行監聽我的文件?

謝謝。

+0

見212頁的文檔中......有一個什麼fileUploadListener – Kukeltje

回答

1

我不知道任何事件。但我相信還有其他兩種選擇:

  1. 只需從fileUploadListener調用checkDocument()。

  2. 呼叫中的onComplete一個remoteCommand:

    <p:fileUpload ... oncomplete="rc()" /> 
    <p:remoteCommand name="rc" update="carDocumentError" actionListener="#{carEditDocumentController.checkDocument()}" /> 
    
+0

謝謝您的回答。我發現了一個解決方案,並且不可能像這樣放置一個。我只是在fileUploadListener調用的函數中添加我的函數checkDocument() –

+0

是的,這就是我試圖在第1點中制定的 –

+1

對不起。我讀得太快了 –