Tur*_*dfa 4 jsf primefaces jsf-2
我收到"java.lang.UnsupportedOperationException:未实现延迟加载." 错误.当我对项目进行debub时,lazyModel的构造函数正在运行,但是不执行load方法.
我的xhtml页面;
<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">
Run Code Online (Sandbox Code Playgroud)
我的控制员;
private LazyDataModel<Envelope> lazyEnvelopeDataModel;
public void init(){
...
lazyEnvelopeDataModel = new LazyEnvelopeDataModel(genericService,envelope);
}
Run Code Online (Sandbox Code Playgroud)
我懒惰的数据模型;
@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;
}
Run Code Online (Sandbox Code Playgroud)
Dan*_*lor 17
有两种load方法LazyDataModel:
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.");
}
Run Code Online (Sandbox Code Playgroud)
这是抛出错误的地方.您正在使用多重排序,因此您应该覆盖第二个.
| 归档时间: |
|
| 查看次数: |
6808 次 |
| 最近记录: |