3
我試圖在CellTable中實現分頁,但它當前顯示「1-10個10」記錄而不是「1-10個1000個」記錄。我不確定我可以在哪裏更新總記錄數。我AsyncDataProvider看起來是這樣的:如何獲取GWT CellTable分頁的總行數
AsyncDataProvider<OutletSearchVO> latestProvider = new AsyncDataProvider<OutletSearchVO>() {
@Override
protected void onRangeChanged(HasData<OutletSearchVO> display) {
final int start = display.getVisibleRange().getStart();
int length = display.getVisibleRange().getLength();
AsyncCallback<List<OutletSearchVO>> callback = new AsyncCallback<List<OutletSearchVO>>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(List<OutletSearchVO> result) {
updateRowData(start, result);
}
};
// The remote service that should be implemented
service.getOutletPage(start, length, callback);
}
};
我用搶記錄的SQL與此類似:
SELECT *
FROM (SELECT outlet_id,
outlet_name,
image,
ROWNUM rn
FROM ( SELECT outlet_id outlet_id,
account_name outlet_name,
image_score image,
FROM outlets)
ORDER BY OOI.created_on DESC, OOI.account_name))
WHERE rn > ? AND rn < ?
問號由開始和結束範圍內取代了一份準備好的聲明。