Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Primefaces 3.5如何使用dataExporter导出不可见的dataTable行_Java_Jsf_Primefaces - Fatal编程技术网

Java Primefaces 3.5如何使用dataExporter导出不可见的dataTable行

Java Primefaces 3.5如何使用dataExporter导出不可见的dataTable行,java,jsf,primefaces,Java,Jsf,Primefaces,我使用primefaces 3.5,我有一个p:dataTable,其中包含一些行和数据,我想将这些数据导出到xls文件或其他文件中 我使用了代码: 这个很好用 我的问题是,我希望在导出的文件和浏览器数据表中有不同的单元格文本 e、 g在导出的xls文件中,我需要其他日期格式,然后在浏览器数据表中。否则,浏览器单元格中的文本太长 我试图仅为导出的表添加一个rendered=“false”和exportable=“true”的附加列。但不幸的是,它不起作用 有人知道怎么做吗?我找到了解决问题的

我使用primefaces 3.5,我有一个p:dataTable,其中包含一些行和数据,我想将这些数据导出到xls文件或其他文件中

我使用了代码:


这个很好用

我的问题是,我希望在导出的文件和浏览器数据表中有不同的单元格文本

e、 g在导出的xls文件中,我需要其他日期格式,然后在浏览器数据表中。否则,浏览器单元格中的文本太长

我试图仅为导出的表添加一个rendered=“false”和exportable=“true”的附加列。但不幸的是,它不起作用


有人知道怎么做吗?

我找到了解决问题的解决办法

为了使我的dataTabe for browser中的单元格文本不可见,我将css syle“visibility:hidden;”放在一些h:outputText中



只为dataExporter创建列会更好,但我没有找到解决方案。

将呈现的标记设置为false时,它目前不起作用(报告为bug:),但您可以使用css这样做:

 <p:column headerText="#{msg['book.coverType']}" style="display:none;">
         <h:outputText value="#{book.coverType}"/>
</p:column>
您可以编写如下方法:

public void addCoverType(HSSFWorkbook workbook, List<Book> books) {

    HSSFSheet sheet = workbook.getSheetAt(0);
    HSSFCell cell = null;

 //row 0 is the header (not automatically added by primefaces)
 //add a fifth cell to each row
    for (int i = 1; i < sheet.getLastRowNum() + 1; i++) {
        sheet.getRow(i).createCell(4);
        cell = sheet.getRow(i).getCell(4);
        cell.setCellValue(book.get(i - 1).getCoverType());
    }
    log.debug("cover type added");
}
public void addCoverType(HSSF工作簿、列表手册){
HSSFSheet sheet=工作簿。getSheetAt(0);
HSSFCell单元=空;
//第0行是标题(不是由primefaces自动添加的)
//每行添加第五个单元格
对于(int i=1;i
如果您设置了可排序列,那么也会自动遵守顺序:-D

public void addCoverType(HSSFWorkbook workbook, List<Book> books) {

    HSSFSheet sheet = workbook.getSheetAt(0);
    HSSFCell cell = null;

 //row 0 is the header (not automatically added by primefaces)
 //add a fifth cell to each row
    for (int i = 1; i < sheet.getLastRowNum() + 1; i++) {
        sheet.getRow(i).createCell(4);
        cell = sheet.getRow(i).getCell(4);
        cell.setCellValue(book.get(i - 1).getCoverType());
    }
    log.debug("cover type added");
}