未渲染的p:dataTable最终出现在pe:exporter PDF中

问题描述 投票:2回答:1

我有2个数据表:

<p:dataTable id="tbl1" var="prop1" value="#{bean.prop1}" rendered="#{bean.listP1.size() != 0}">
// ...
</p:dataTable>

<p:dataTable id="tbl2" var="prop2" value="#{bean.prop2}" rendered="#{bean.listP2.size() != 0}">
// ...
</p:dataTable>

在XHTML页面上,经过一些操作,根据listP1listP2的大小,我都得到了正确的结果。

我的问题是单击导出按钮]后>

<h:commandLink>
    <p:graphicImage value="/resources/icons/download.png" style="width : 35px; height:35px"/>
    <pe:exporter type="pdf" target="tbl1, tbl2" fileName="SurveyResults"/>
</h:commandLink>

我得到了错误的结果:我得到了两个表而不是一个表,因为其中一个表是size = 0

您对解决这个问题有任何想法吗?

我有2个dataTables:// ...

jsf primefaces primefaces-extensions
1个回答
3
投票

pe:exporter不在乎是否提供了您提供的数据表。不过,您可以使用EL为target属性创建动态值,例如:

© www.soinside.com 2019 - 2024. All rights reserved.