版本:eXtremeComponents-1.0.1-RC2
环境:JSF
文件:departments.jsp
<f:view>
<f:loadBundle var="text" basename="#{departmentList.bundleName}"/>
<h:form id="editDepartment">
<ec:table
items="departmentList.departments"
action="${pageContext.request.contextPath}/hr/departments.html"
imagePath="${pageContext.request.contextPath}/images/table/*.gif"
title="${text['userList.title']}"
rowsDisplayed="10"
form="editDepartment" var="department"
retrieveRowsCallback="limit"
filterRowsCallback="limit"
sortRowsCallback="limit"
view="limit"
autoIncludeParameters="false">
<ec:row highlightRow="true">
<ec:column title="${text['department.name']}" property="name"/>
</ec:row>
</ec:table>
</h:form>
</f:view>
文件:DepartmentList.java
public List getDepartments() {
Context context = new HttpServletRequestContext(getRequest());
LimitFactory limitFactory = new TableLimitFactory(context);
Limit limit = new TableLimit(limitFactory);
//int pageSize = limit.getCurrentRowsDisplayed();
//可能是一个bug,生成 limit 的时候,并没有给 currentRowsDisplayed 赋值
int pageSize = limitFactory.getCurrentRowsDisplayed(0, 10);
FilterSet filter = limit.getFilterSet();
Page page = new PageHibernate(limit.getPage(), pageSize);
page.setFilters(FilterUtil.convert(filter));
page = departmentManager.getDepartments(page);
List list = page.getThisPageElements();
limit.setRowAttributes(page.getTotalNumberOfElements(), page.getPageSize());
getRequest().setAttribute("totalRows", new Integer(page.getTotalNumberOfElements()));
return list;
}
结果:
1.从limit中取不到pagesize,可能是一个bug,跟踪TableLimit原码,初始化的时候,并没有给 currentRowsDisplayed 赋值
2.没有显示“最后一页”,这个按钮
3.不能导出excel文件,报错:
There is no export defined. This commonly happens if you do not declare the export (Export or ExportTag) before the row and columns.