GWT - 具有简单寻呼机问题的celltable [英] GWT - celltable with simple pager issue
本文介绍了GWT - 具有简单寻呼机问题的celltable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
检查示例 http://gwt.google.com /samples/Showcase/Showcase.html#!CwCellTable
此处的页面大小定义为15.这是问题 -
- 点击最后一页按钮。显示241到250的结果。
- 现在点击上一个按钮 - 显示226-240的结果。
- 现在点击下一步按钮这是问题所在)。它显示的结果从236到250.而它应该显示241-250。
我在我的项目中遇到同样的问题。
是否有任何修正?
解决方案
这是已知,报告错误。正如在该bug报告中提到的那样,有一个解决方法:
作为解决方法,可以继承SimplePager以覆盖此
在方法setPageStart定义的行为:@覆盖
公共无效setPageStart(INT指数){
如果( this.getDisplay()!= null){
范围range = this.getDisplay()。getVisibleRange();
int pageSize = range.getLength();
//如果(isRangeLimited&安培;&安培; display.isRowCountExact()){
//指数= Math.min(指数,display.getRowCount() - 的pageSize);
//}
index = Math.max(0,index);
if(index!= range.getStart()){
this.getDisplay()。setVisibleRange(index,pageSize);
}
}
}
The cell table pagination is behaving weirdly. check the example from GWT http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTable
The page size here is defined as 15. This is the problem-
- click on last page button. Results for 241 to 250 are shown.
- Now click on previous button - results from 226-240 are shown.
- Now click on next button ( this is where the problem is). It showns results from 236 to 250. Whereas it should have displyed 241-250.
I am having same issue in my project. Is there any fix for this ??
解决方案
This is a known, reported bug. As mentioned in that bug report, there is a workaround:
As workaround, one can subclass SimplePager in order to override this behaviour defined in method setPageStart:
@Override public void setPageStart(int index) { if (this.getDisplay() != null) { Range range = this.getDisplay().getVisibleRange(); int pageSize = range.getLength(); // if (isRangeLimited && display.isRowCountExact()) { // index = Math.min(index, display.getRowCount() - pageSize); // } index = Math.max(0, index); if (index != range.getStart()) { this.getDisplay().setVisibleRange(index, pageSize); } } }
这篇关于GWT - 具有简单寻呼机问题的celltable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文