multiupload update ui:repeat

UI Components for JSF
Post Reply
xxmp1986
Posts: 6
Joined: 07 Jul 2014, 09:17

25 Aug 2014, 17:32

Hello i have this code

Code: Select all

<h:form id="labels" enctype="multipart/form-data">
            <h:inputHidden value="#{excursion_type.id}" id="id" />
            <h:inputHidden value="1" id="thetype" />
            <p:growl id="msg"></p:growl>
            <p:fileUpload value="#{photos.main_photo}" mode="advanced" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" auto="false"
                          fileUploadListener="#{photos.uploadMultiple}" update="msg,:theimages:alvs"  />
</h:form>

<h:form id="theimages">
            <h:inputHidden value="#{excursion_type.id}" id="id2" />
            <h:inputHidden value="1" id="thetype2" />
            <h:inputHidden value="#{excursion_type.id}" />
            Click <h:commandButton action="#{photos.reload()}" value="Reload" />  to refresh the page after uploading multiple photos.
            <h:panelGroup id="alvs">
            <p:lightBox styleClass="imagebox" id="lighbox1"> 
                <ui:repeat value="#{photos.getPhotos(1, excursion_type.id)}" var="thephoto" id="thephotoss">
                    <h:outputLink value="#{facesContext.externalContext.requestContextPath}/resources/PhotoGallery/#{thephoto.path}" title="#{excursion_type.title_en}"> 

                        <p:graphicImage  name="PhotoGallery/#{thephoto.path}"  style="height: 77px; width: 100px; margin-right: 5px;"
                                         id="testt" />
                        <p:contextMenu for="testt">
                            <p:menuitem value="Delete"   onclick="window.location='#{facesContext.externalContext.requestContextPath}/faces/deletephoto.xhtml?id=#{thephoto.id}'"  icon="ui-icon-close" />
                            <p:menuitem value="Set main"  onclick="window.location='#{facesContext.externalContext.requestContextPath}/faces/setmainphoto.xhtml?id=#{thephoto.id}'" icon="ui-icon-flag" />
                        </p:contextMenu>
                    </h:outputLink>
                </ui:repeat>
            </p:lightBox>
            </h:panelGroup>
        </h:form>

at the theimages ->lighbox1->thephotoss i saw the uploaded photos. I want when the user upload new photos the thephotoss to be updated and saw the new photos.
Can i do this or there is another way to do it?
Thank you

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests