使用 GWT 2.5.1,SimplePager.java 有这个方法:
@Override
protected void onRangeOrRowCountChanged() {
HasRows display = getDisplay();
label.setText(createText());
// Update the prev and first buttons.
setPrevPageButtonsDisabled(!hasPreviousPage());
// Update the next and last buttons.
if (isRangeLimited() || !display.isRowCountExact()) {
setNextPageButtonsDisabled(!hasNextPage());
setFastForwardDisabled(!hasNextPages(getFastForwardPages()));
}
}
为什么仅当范围有限或行数不准确时才启用/禁用下一个/最后一个按钮?我有一个设置为 range limited false 的寻呼机,并且我的异步数据提供程序指定在我更新行计数时行计数是准确的。使用此设置,下一个/最后一个分页按钮将永远不会更新!
我只是使用这个错误,还是一个错误?
我通过继承 SimplePager 来解决这个问题,以允许我进入 onRangeOrRowCountChanged() 底部的那个块:
@Override
protected void onRangeOrRowCountChanged() {
boolean rangeLimited = isRangeLimited();
super.setRangeLimited(true);
super.onRangeOrRowCountChanged();
super.setRangeLimited(rangeLimited);
}
最佳答案
AIUI,如果范围没有限制,你明确允许pager超出可用数据并显示空页。
如果行数不准确,则应启用下一步按钮,因为 hasNextPage
将返回 true
(如果快进超出了已知的(尽管不精确)行数,则会禁用快进。无论范围是否有限,这都适用,这可能是也可能不是错误。
关于gwt - 为什么 GWT SimplePager 下一个/最后一个按钮仅在范围有限或行数不准确时才禁用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16921041/