Salı, Ekim 27, 2009

rich:modalPanel ve rich:fileUpload

rich:fileUpload richfaces kütüphanesinde bulunan çok kullanışlı bir component. Fakat sayfa içinde biraz yer kapladığı için bazen modalpanel açıp onun içinde kullanmak gerekebilir.
rich:modalPanel içinde rich:fileUpload kullanmak için rich:modalPanel in form içinde olmaması gerekiyor. aynı zamanda modalpanel'in içinde fileupload'u içeren bir form olması gerekiyor. yoksa fileupload componenti çalışmaz. örnek kullanımı şöyle olabilir;
<h:form id="outform">
...
<a4j:commandButton value="Upload Excel File" id="fileuploadbutton">
<rich:componentControl for="fileuploadpanel" attachTo="fileuploadbutton" operation="show" event="onclick" />
</a4j:commandButton>
...
</h:form>
<rich:modalPanel id="fileuploadpanel" zindex="2000" autosized="true">
<f:facet name="header">
<h:outputText value="File Upload Panel"></h:outputText>
</f:facet>
<h:form id="fileuploadform">
<rich:fileUpload fileUploadListener="#{testBean.fileUploadListener}" acceptedTypes="csv" ontyperejected="alert('you can upload csv files');">
</rich:fileUpload>
...
</h:form>
</rich:modalPanel>

Hiç yorum yok:

Yorum Gönder