1 Reply Latest reply on Jul 12, 2010 10:23 AM by p_kris

    rich:fileUpload reRender problem onclear

    p_kris

      Hi

       

      I have the following code on my XHTML page

       

      <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
                       maxFilesQuantity="#{fileUploadBean.uploadsAvailable}"
                       addControlLabel="Attach File"
                       id="upload" immediateUpload="#{fileUploadBean.autoUpload}"
                       acceptedTypes="jpg, gif" allowFlash="#{fileUploadBean.useFlash}">
           <a4j:support event="onclear" ajaxSingle="true" reRender="upload">
                <a4j:actionparam name="fname" noEscape="true" value = "(event.memo.entry)?event.memo.entry.fileName:'' "
                                 assignTo="#{fileUploadBean.fileName}"
                                 actionListener="#{fileUploadBean.clearUploadData}" />
           </a4j:support>
      </rich:fileUpload>
      

       

      When the user clicks on the clear button, clearUploadData() method is called and there I am removing the file from the list and resetting the uploadsAvailable value accordingly.

      In order to reflect this change on the web page, I used reRender="upload"

      Due to the reRender, it is clearing all the fileItems on the page.  However I want the particular file to be deleted from the fileItems list on the page (It is fine to clear all the fileItems when I click ClearAll).

      I tried using reRender="fileItems", but this will not update the maxFilesQuantity.

       

      I want to clear only the selected item and also want to update the maxFilesQuantity.

       

      Thanks