I have a problem with overriding load of primefaces lazydatamodel. The error points at the load method. I am using primefaces 5.0. Working in 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);
}
}
As you can see, I am implementing @Override but it still points out that:
The method load(int, int, String, SortOrder, Map) of type new LazyDataModel(){} must override or implement a supertype method
Overriding method now in PF 5 should look
public List<Car> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,Object> filters)
instead
public List<Car> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,String> filters)
Map<String,Object>
instead Map<String,String>
in your method
Look example http://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml