p:dataExporter仅选择行 [英] p:dataExporter selected rows only

查看:112
本文介绍了p:dataExporter仅选择行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有多个选择复选框的<p:dataTable>.我只想将某些行导出到我的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 = 31804 https://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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆