gwtpagergwt-2.2-celltablegwt-celltable

GWT SimplePager LastButton issue


I am facing problem with lastButton of SimplePager. I have 3 pages in celltable, Page size=11 (1 empty record + 10 records(with value)), Total record=26.

I used CustomerPager by extending SimplePager.

In 1st attempt 1+10 records display in celltable : Next & Last page button is enabled (First & Prev button disabled) which is correct. But LastPage button not working... :( Dont know whats the issue... (event not fires)

Strange behavior:

@1 Last page button is working only when I visit to last page(3 page in my case).

@2 Assume I am on 1st page n I moved to 2nd page(Total 3 pages in celltable). that time all buttons are enabled which is correct. In this case Last button is working but behave like Next Button

My GWT application integrated into one of our product so cant debug it from client side.

May be index value is improper in setPage(int index) method from AbstractPager

Code flow is as follows for Last button

//From SimplePager

lastPage.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          lastPage();
        }
      });


       @Override
  public void lastPage() {
    super.lastPage();
  }

 // From AbstractPager
  /**
   * Go to the last page.
   */
  protected void lastPage() {
    setPage(getPageCount() - 1);
  }
 protected void setPage(int index) {
    if (display != null && (!isRangeLimited || !display.isRowCountExact() || hasPage(index))) {
      // We don't use the local version of setPageStart because it would
      // constrain the index, but the user probably wants to use absolute page
      // indexes.
      int pageSize = getPageSize();
      display.setVisibleRange(pageSize * index, pageSize);
    }
  }

or may be some conditions false from above code(from setPage())

actual record = 26 and 3 Empty record (1st Empty record/page)

May b problem with dataSize :|

How I can check number of pages based on the data size? ?

How can I solve this problem?


Solution

  • Only added cellTable.setRowCount(int size, boolean isExact) in OnRange change method AsyncDataProvider. My problem is solved :)

    protected void onRangeChanged(HasData<RecordVO> display) {
    //----- Some code --------
    cellTable.setRowCount(searchRecordCount, false);
    //----- Some code --------
    }