p:dataExporter 仅选定行 [英] p:dataExporter selected rows only
问题描述
我有一个带有多选复选框的
.我只想将一些行导出到我的 pdf.现在,当我尝试根据选定的行导出时,它只给我从顶部开始的行.例如,如果我的数据表中有 10 行,我选择 1,4,7,9 导出到我的 PDF.我总是在我的 pdf 中得到第 1、2、3、4 行.我正在使用 PrimeFaces 5.1 jar.我也用 5.2 jar 试过了,还是一样的问题.
I have a <p:dataTable>
with the multiple selection checkbox. I want to export only some rows to my pdf. Right now when I try to export based on the selected rows it gives me only the rows from the top. For example if I have 10 rows in my datatable and I select 1,4,7,9 to be exported to my PDF. I always get rows 1,2,3,4 in my pdf. I am using the PrimeFaces 5.1 jar. I tried it with 5.2 jar also, Still same issue.
<p:dataTable id="dataall"
var="cars"
value="#{carsEntry.carssUser}"
rows="10"
rowIndexVar="rowId"
paginator="true"
rowKey="#{cars}"
paginatorTemplate="{CurrentPageReport}
{FirstPageLink} {PreviousPageLink}
{PageLinks} {NextPageLink}
{LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15"
editable="true"
selection="#{carsEntry.selectedRows}">
<p:column selectionMode="multiple" exportable="false"/>
<p:column headerText="ID" sortBy="#{cars.id}">
<h:outputText value="#{cars.id}" />
</p:column>
</p:dataTable>
<h:commandLink>
<h:outputText value="PDF" />
<p:dataExporter type="pdf"
target="dataall"
fileName="AllCars"
selectionOnly="true"/>
</h:commandLink>
检查了这两个但仍然没有明确的答案.
Checked these two but still no clear answer.
http://forum.primefaces.org/viewtopic.php?f=3&t=31804https://code.google.com/p/primefaces/issues/detail?id=7406
推荐答案
感谢我的朋友 Sathish.我能够找到解决此问题的方法.我将选定的值填充到一个新的数据表并导出该数据.因此我得到了正确的值导出.我为第二个数据表制作了 render="false".
Thanks to my friend Sathish. I was able to find out a work around for this issue. I populate the selected values to a new datatable and export that data. Hence I get the correct values exported. I make rendered="false" for the second data table.
这篇关于p:dataExporter 仅选定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!