Primefaces fileUpload仅可触发时间 [英] Primefaces fileUpload only works firts time

查看:56
本文介绍了Primefaces fileUpload仅可触发时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我上传文件时,我需要更新一些组件.它仅在我第一次使用时有效.

When I upload a file, I need to update some componentes. It only works first time I do it.

XHTML:

<p:fileUpload id="Uploader" fileUploadListener="#{cc.attrs.updateImageAction}"  
                    mode="advanced"
                    update="#{cc.id}:updatableElements #{cc.attrs.ajaxRender} #{cc.attrs.ajaxRenderCropDialog}"
                    auto="true" 
                    multiple="false" 
                    sizeLimit="#{cc.attrs.sizeLimit}"   
                    allowTypes="#{imageManagerServiceBean.imageFileAllowedTypesRegEx}"
                    label="#{messages['generic.images.select']}"
                    uploadLabel="#{messages['generic.images.upload']}"
                    cancelLabel="#{messages['generic.images.cancel']}"
                    invalidSizeMessage="#{cc.attrs.invalidFileSizeMessage}"
                    invalidFileMessage="#{messages['generic.images.invalidtype']}"
                    >
            </p:fileUpload>

有什么主意吗?

推荐答案

我已经解决了这个问题.我不知道为什么,但是更改#{cc.attrs.ajaxRenderCropDialog}的值,此更新有效.

I have solved the problem. I don't know why but changing the value of #{cc.attrs.ajaxRenderCropDialog}, the update works.

之前::artistImageCropperDialog:imageCropperDialog

Before: :artistImageCropperDialog:imageCropperDialog

之后::artistImageCropperDialog:imageCropperForm

After: :artistImageCropperDialog:imageCropperForm

ImageCropperDialog xhtml代码:

ImageCropperDialog xhtml code:

        <h:panelGroup layout="block" styleClass="links">
            <h:panelGroup id="imageCropperDialog" layout="block" styleClass="hidden">
                <h:form id="imageCropperForm">
                        <h:panelGrid>
                            <p:imageCropper id="cropperImage" value="#{cc.attrs.croppedImage}"
                                image="/upload/#{cc.attrs.imageTmp}"
                                initialCoords="#{cc.attrs.initialCoords}"
                                aspectRatio="1"
                                minSize="#{cc.attrs.minSize}"
                                required="true"
                                requiredMessage="Hay que seleccionar parte de la imagen"
                                />
                        </h:panelGrid>
                    <h:commandButton id="acceptButton" action="#{cc.attrs.acceptCropAction}" styleClass="hidden">
                        <f:ajax execute="@form" render="@form :messages :form:pictureHandler:updatableElements" onevent="onAcceptCropEvent"/>
                    </h:commandButton>

                    <h:commandButton id="cancelButton" action="#{cc.attrs.cancelCropAction}" styleClass="hidden">
                         <f:ajax execute="@this" render="@form :messages"/>
                    </h:commandButton>

                </h:form>
            </h:panelGroup>
        </h:panelGroup>
    </composite:implementation>

其他xhtml中对话框的声明:

Declaration of dialog in other xhtml:

<ui:define name="dialogs">
        <app:imageCropperDialog id="artistImageCropperDialog"
                        croppedImage="#{festivalArtistEditPageBean.croppedImage}"
                        imageTmp="#{festivalArtistEditPageBean.imageTemp}"
                        acceptCropAction="#{festivalArtistEditPageBean.cropImage()}"
                        cancelCropAction="#{festivalArtistEditPageBean.cancelCropImage()}"
                        minSize="#{festivalArtistEditPageBean.cropMinSize}"
                        initialCoords="#{festivalArtistEditPageBean.cropInitialCoords}"
                        >
        </app:imageCropperDialog>
    </ui:define>

这篇关于Primefaces fileUpload仅可触发时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆