<p:fileUpload> element don't show correctly when it's inside a <c:forEach>

jQuery UI Widgets
Post Reply
litoguemi
Posts: 2
Joined: 27 Apr 2018, 00:55

07 May 2018, 21:20

I'm generating dinamic <p:fileUpload> elements using <c:forEach>, the elements show after an ajax request but they don't look correctly, I have seen in javascript console and shows an error: Widget not available: FileUpload

That occurs when I generate some elements, but if I generate only one, It is showed correctly.

I'm using Primefaces 6.2 and JSF 2.2, I have configured the application for uploading files because I had used in other places the same element.

Another detail is that all thouse elements: <c:forEach> and <p:fileUpload> are inside a <p:dataTable> which is updated with an ajax request.

Code: Select all

<p:dataTable id="dataTableList"
                     var="act" widgetVar="actsTable" rowIndexVar="itemCouter"
                 value="#{controller.dataList}">                
           
            <c:forEach items="#{controller.columnList}" var="column" varStatus="colLoopStatus" >
                <p:column>
                    <f:facet name="header">
                        <h:outputText  value="#{column.header}"/>                        
                    </f:facet>

                    <h:panelGroup rendered="#{column.tipoDato eq 'BLOB'}">                        

                        <h:panelGroup rendered="#{controller.persistAction eq 'CREATE'}">
                            <h:panelGroup>
                                <p:fileUpload fileUploadListener="#{controller.addFile}" 
                                            multiple="false" auto="true" sizeLimit="10000000" allowTypes="/(\.|\/)(jpe?g|png|pdf)$/"
                                            label="Upload File" 
                                            invalidFileMessage="Invalid File" 
                                            invalidSizeMessage="Invalid Size">
                                    <f:attribute name="actwCodigo" value="#{column.codigo}" />                                    
                                </p:fileUpload>                                                                                                       
                        </h:panelGroup>
                    </h:panelGroup>               
        </p:dataTable>
 
At the beginning Javascript console shows that error but if I refresh the page, the elements look correctly.

I hope someone can help me....

Post Reply

Return to “PrimeUI”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests