我正在尝试在 CellTable 中实现分页,但它当前显示“1-10 of 10”记录而不是“1-10 of 1000”记录。我不确定在哪里可以更新总记录数。我的 AsyncDataProvider 看起来像这样:
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 < ?
问号被准备好的语句中的开始和结束范围替换。