![](/img/trans.png)
[英]Row selection not working in primefaces (5.3) data table when the lazy loading is implemented, but it works without lazy loading
[英]primefaces lazy loading is not implemented
我收到“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">
我的控制員;
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.");
}
這是拋出錯誤的地方。 您正在使用多重排序 ,因此您應該覆蓋第二個。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.