使用SimplePager进行CellTable分页



关于这个bug: http://groups.google.com/group/google-web-toolkit/browse_thread/thread/45e77082b796281d/d5101729e83a74ff?lnk=gst&q=pager%20last%20page#d5101729e83a74ff

我想要一个这样的行为:

tablePager = new SimplePager() {
            @Override
            public boolean hasNextPage() {
                if( this.getPage() < this.getPageCount() ) {
                    return true;
                } 
                else {
                    return false;
                }
            } 
        };
然而,

不起作用:它只在加载时调用。你觉得呢?

pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0,
                true) {
            private int pageSize = 10;
            @Override
            public int getPageSize() {
                return pageSize;
            }
            @Override
            public void previousPage() {
                if (getDisplay() != null) {
                    Range range = getDisplay().getVisibleRange();
                    setPageStart(range.getStart() - getPageSize());
                }
            }
            @Override
            public void setPageStart(int index) {
                if (getDisplay() != null) {
                    Range range = getDisplay().getVisibleRange();
                    int displayPageSize = getPageSize();
                    if (isRangeLimited() && getDisplay().isRowCountExact()) {
                        displayPageSize = Math.min(getPageSize(), getDisplay()
                                .getRowCount() - index);
                    }
                    index = Math.max(0, index);
                    if (index != range.getStart()) {
                        getDisplay().setVisibleRange(index, displayPageSize);
                    }
                }
            }
            @Override
            public void nextPage() {
                if (getDisplay() != null) {
                    Range range = getDisplay().getVisibleRange();
                    setPageStart(range.getStart() + getPageSize());
                }
            }
        };
        pager.setRangeLimited(true);
        pager.setDisplay(cellTable);
        pager.setPageSize(10);

相关内容

  • 没有找到相关文章