我有覆盖主要负载lazydatamodel的问题。加载方法的错误点。我正在使用primefaces 5.0。在Jboss Developer Studio 7.1中工作
private LazyDataModel<City> mdlCityList;
@PostConstruct
public void init() {
try {
this.mdlCityList = new LazyDataModel<City>() {
private static final long serialVersionUID = 1L;
@Override
public List<City> load(int first, int pageSize,
String sortField, SortOrder sortOrder,
Map<String, String> filters) {
mdlCityList.setRowCount(cityFacade.count(filters));
return cityFacade.getResultList(first, pageSize, sortField,
sortOrder, filters);
}
};
mdlCityList.setRowCount(cityFacade
.count(new HashMap<String, String>()));
} catch (Exception e) {
System.out.println("Exception in CityListProducer " + e);
}
}
正如您所看到的,我正在实施@Override,但它仍然指出:
方法load(int,int,String,SortOrder,Map) 类型new LazyDataModel(){}必须覆盖或实现 超类型方法
答案 0 :(得分:12)
现在PF 5中的覆盖方法应该是
public List<Car> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,Object> filters)
代替
public List<Car> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,String> filters)
在您的方法中 Map<String,Object>
代替Map<String,String>
查看示例http://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml