Reputation: 463
I´m trying to re-enable the control button in a rich:uploadFile after upload the file.
I have:
<rich:panel id="fileuploader">
<script type="text/javascript">alert("rendering");</script>
<rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
maxFilesQuantity="1" id="upload" autoclear="true"
acceptedTypes="jpg, gif, png, bmp" >
<a4j:support event="onuploadcomplete" reRender="fileuploader" />
</rich:fileUpload>
<a4j:commandButton value="reRender" reRender="fileuploader"/>
</rich:panel>
I put a Script to be sure the panel is re-rendering. I read that you can reRender the uploadFile control, or refresh the whole page. After I upload the file, the controlButton gets disabled, and although I do a rerender with the commandButton, the control button is still disabled. But when I do a full refresh page, the control is ok.
Im using rich faces 3.3.3
Any help?
Thanks
[Edit]
I found the problem, but not the solution yet! I have a table with multiple rows so I have multiple rich:fileUpload's. If I just show one row and it works.
Upvotes: 0
Views: 1534
Reputation: 85779
I've faced the same problem, to solve it I rerendered the control, not a panel that holds it, I don't know if this approach will work (but it does for me):
EDIT: Changed your code for mine, maybe there is a difference that I can't see.
<rich:fileUpload id="fuArchivoExcel" maxFilesQuantity="1"
listHeight="60px" listWidth="350px" immediateUpload="false"
fileUploadListener="#{cargaDocumentoRequerido.subeArchivo}"
addControlLabel="Seleccionar archivo" uploadControlLabel="Subir"
clearAllControlLabel="Borrar archivos"
clearControlLabel="Borrar archivo" stopControlLabel="Detener" autoclear="true">
<f:facet name="label">
<h:outputText value="Se han subido {_KB}KB de {KB}KB" />
</f:facet>
<a4j:support event="onuploadcomplete" reRender="fuArchivoExcel,pnlMensajesError"
oncomplete="finCargaArchivo('#{cargaDocumentoRequerido.mensaje.idMensaje}', '#{cargaDocumentoRequerido.mensaje.descMensaje}')" />
</rich:fileUpload>
EDIT (based in comments)
When you use the <rich:fileUpload>
inside a repeater like <rich:dataTable>
, you should rerender the repeater component instead of the single component. This will solve your problem.
Upvotes: 1