Primefaces 惰性数据表无法识别方法加载
Primefaces lazy datatable does not recognize method load
我在下面有一个 primefaces 数据表:
<p:dataTable id="table_lista_grupos" value="#{grupoClasseBean.gldm}" var="item"
widgetVar="lista_grupos" rowKey="#{item.codigo}" paginator="true" rows="10"
styleClass="panelGrande" paginatorPosition="bottom" sortMode="multiple"
filteredValue="#{grupoClasseBean.listaGruposFiltrados}" rowHover="true"
resizeMode="expand" selectionMode="single" lazy="true" rowsPerPageTemplate="10,20,30"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" >
我需要实现延迟加载,
我按照文档进行了操作,并在下面创建了 class:
public class GrupoLazyDataModel extends LazyDataModel<Grupo>{
private static final long serialVersionUID = 1L;
private List<Grupo> datasource;
public GrupoLazyDataModel(List<Grupo> datasource) {
this.datasource = datasource;
setRowCount(datasource.size());
}
@Override
public List<Grupo> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
return new ArrayList<Grupo>();
}
}
我在我的 ManagedBean
中调用这个 class
@Named
@RequestScoped
public class GrupoClasseBean implements Serializable {
private LazyDataModel<Grupo> gldm;
@PostConstruct
public void init() {
Map<TipoParametro, Object> params = new HashMap<>();
params.put(TipoParametro.TIPO, tipo);
listaGrupos = (List<Grupo>) rule.list(0, 100, params);
gldm = new GrupoLazyDataModel(listaGrupos);
}
}
但是当我执行我的软件时,我收到错误消息:
Receiver class br.gov.sp.sefaz.siafem.cm.ui.grpcls.GrupoLazyDataModel does not define or inherit an implementation of the resolved method abstract load(IILjava/util/Map;Ljava/util/Map;)Ljava/util/List; of abstract class org.primefaces.model.LazyDataModel.
我的环境是primefaces 5.3,tomcat9,jdk1.8,netbeans 12.2,数据库derby
我解决了这个问题,更新了 primefaces 版本,从 5.3 到 10.0
我在下面有一个 primefaces 数据表:
<p:dataTable id="table_lista_grupos" value="#{grupoClasseBean.gldm}" var="item"
widgetVar="lista_grupos" rowKey="#{item.codigo}" paginator="true" rows="10"
styleClass="panelGrande" paginatorPosition="bottom" sortMode="multiple"
filteredValue="#{grupoClasseBean.listaGruposFiltrados}" rowHover="true"
resizeMode="expand" selectionMode="single" lazy="true" rowsPerPageTemplate="10,20,30"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" >
我需要实现延迟加载, 我按照文档进行了操作,并在下面创建了 class:
public class GrupoLazyDataModel extends LazyDataModel<Grupo>{
private static final long serialVersionUID = 1L;
private List<Grupo> datasource;
public GrupoLazyDataModel(List<Grupo> datasource) {
this.datasource = datasource;
setRowCount(datasource.size());
}
@Override
public List<Grupo> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
return new ArrayList<Grupo>();
}
}
我在我的 ManagedBean
中调用这个 class@Named
@RequestScoped
public class GrupoClasseBean implements Serializable {
private LazyDataModel<Grupo> gldm;
@PostConstruct
public void init() {
Map<TipoParametro, Object> params = new HashMap<>();
params.put(TipoParametro.TIPO, tipo);
listaGrupos = (List<Grupo>) rule.list(0, 100, params);
gldm = new GrupoLazyDataModel(listaGrupos);
}
}
但是当我执行我的软件时,我收到错误消息:
Receiver class br.gov.sp.sefaz.siafem.cm.ui.grpcls.GrupoLazyDataModel does not define or inherit an implementation of the resolved method abstract load(IILjava/util/Map;Ljava/util/Map;)Ljava/util/List; of abstract class org.primefaces.model.LazyDataModel.
我的环境是primefaces 5.3,tomcat9,jdk1.8,netbeans 12.2,数据库derby
我解决了这个问题,更新了 primefaces 版本,从 5.3 到 10.0