Primefaces: commandButton ajax="false" は p:dataExporter と p:fileDownload で動作しません。
written-by
Alfonso Crisci
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
legacy-article
learn-legacy-article-disclaimer-text
ご覧のページは、お客様の利便性のために一部機械翻訳されています。また、ドキュメントは頻繁に更新が加えられており、翻訳は未完成の部分が含まれることをご了承ください。最新情報は都度公開されておりますため、必ず英語版をご参照ください。翻訳に問題がある場合は、こちら までご連絡ください。
問題
Primefaces <p:commandButton ajax="false" />
を p:dataExporter
と p:fileDownload
で使用すると、ページが正しくレンダリングされず、視覚的な問題が発生します。
環境
解像度
p:dataExporter
と p:fileDownload
をポートレットで使用する場合、それぞれ別のフォームに入れるのがベストプラクティスです。 非Ajax UICommand
コンポーネントが p:dataExporter
または p:fileDownload
を持つフォームに含まれている場合、JSFポートレットで失敗します。 下のようなものです:
<h:body> <h:form> <p:commandButton value="commandButton ajax=false doesn't work" ajax="false" /> </h:form> <h:form> <h1>not working example - contains PrimeFaces dataExporter</h1> <p:dataTable id="tabledata" var="r" value="#{controller.tabledata}"> <h:outputText value="this is the header where the button was" /> <p:commandButton ajax="false" value="csv export"> <p:dataExporter target="tabledata" type="csv" fileName="tabledata" /> </p:commandButton> </f:facet> <p:column> <h:outputText value="#{r}" /> </p:column> </p:dataTable> <p:commandLink value="switch to working example" action="working" /> </h:form>
なるように変更するものとする:
<h:body> <h:form> <p:commandButton value="commandButton ajax=false doesn't work" ajax="false" /> <h1>not working example - contains PrimeFaces dataExporter</h1> <p:dataTable id="tabledata" var="r" value="#{controller.tabledata}"> <h:outputText value="this is the header where the button was" /> <p:commandButton ajax="false" value="csv export"> <p:dataExporter target="tabledata" type="csv" fileName="tabledata" /> </p:commandButton> </f:facet> <p:column> <h:outputText value="#{r}" /> </p:column> </p:dataTable> <p:commandLink value="switch to working example" action="working" /> </h:form>
did-this-article-resolve-your-issue