I am using the primeFaces 2.2.1
I am using Primefaces 2.2.1 with jsf 2.0, and using dataExporter component along with with lazyDataModel in "DataTable".
if I set the attribute of dataExporter component to "pageOnly=true" , Then i'm getting exception .:"Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'tableEntity' resolved to null"
After debugging I found out that, if the pageOnly is set to true, size is setting from pagesize of datatable.
Suppose I have set the pagesize of datatable to 10. (in lazyDataModel setPageSize()). But I have only 5 record.(Only 5 rows). If i do a export , "pageOnly=true", then I'm getting exception in ExcelExporter.class(lineno: 97).
In ExcelExporter.class line no: 49, ie
Code: Select all
int size = pageOnly ? (first + table.getRows()) : table.getRowCount();
So it will loop for 10 times. But I have only 5 rows.
Code: Select all
for(int i = first; i < size; i++) { //size is 10
table.setRowIndex(i);
HSSFRow row = sheet.createRow(sheetRowIndex++);
for (int j = 0; j < numberOfColumns; j++) {
UIColumn column = columns.get(j);
if(column.isRendered())
addColumnValue(row, column.getChildren(), j);
}
}
Expected result : it should export my page.
Changes to do the code to work:
In ExcelExporter.class You should have a check to know whether the rowCount is less than the pagesize. If it is less then it should take rowcount for size. ie if(table.getRowCount() < table.getRows())