开发者

CellTable paging with SimplePager

开发者 https://www.devze.com 2023-03-31 12:28 出处:网络
Referring to this bug: http://groups.google.com/group/google-web-toolkit/browse_thread/thread/45e77082b796281d/d5101729e83a74ff?lnk=gst&q=pager%20last%20page#d5101729e83a74ff

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

Well, I want a behavior like that:

tablePager = new SimplePager() {
            @Override
            public boolean hasNextPage() {
                if( this.getPage() < this.getPageCount() ) {
                    return true;
                } 
                else {
                    return false;
  开发者_StackOverflow中文版              }
            } 
        };

However, it does not work: it's called only at loading. What do you think?


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消