primefaces延迟加载未实现 [英] primefaces lazy loading is not implemented
本文介绍了primefaces延迟加载未实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到"java.lang.UnsupportedOperationException:未实现延迟加载".错误.当我degub项目时,lazyModel的构造函数正在工作,但未执行load方法.
I am getting "java.lang.UnsupportedOperationException: Lazy loading is not implemented." error. When i degub the project, lazyModel's constructor is working but load method is not executed.
我的xhtml页面;
my xhtml page;
<p:dataTable id="envelopelistid" var="envelope"
value="#{incomingEnvelopeListController.lazyEnvelopeDataModel}"
selection="#{incomingEnvelopeListController.selectedEnvelope}" selectionMode="single"
rowKey="#{envelope.instanceIdentifier}"
sortMode="multiple"
lazy="true"
style="min-height: 300px"
paginator="true"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15"
rows="10">
我的控制器;
private LazyDataModel<Envelope> lazyEnvelopeDataModel;
public void init(){
...
lazyEnvelopeDataModel = new LazyEnvelopeDataModel(genericService,envelope);
}
我的惰性数据模型;
@Override
public List<Envelope> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters) {
if (sortField == null) {
sortField = "identificationId";
}
datasource = genericService.getByTemplate(envelopeModel, first, pageSize, new Order(sortField, Order.convertSortOrder(sortOrder.toString())));
setRowCount((int) genericService.getCountByTemplate(envelopeModel));
return datasource;
}
推荐答案
LazyDataModel
中有2个load
方法:
public List<T> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,String> filters) {
throw new UnsupportedOperationException("Lazy loading is not implemented.");
}
public List<T> load(int first, int pageSize, List<SortMeta> multiSortMeta, Map<String,String> filters) {
throw new UnsupportedOperationException("Lazy loading is not implemented.");
}
这是引发错误的地方.您正在使用 multisort ,因此您应该覆盖第二个.
This is where the error is thrown. You are using multisort, so you should override the second.
这篇关于primefaces延迟加载未实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文