Friday, May 31, 2013

SimplePager next/last not being disabled appropriately


Using GWT 2.5.1, SimplePager.java has this method:

  @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()));
    }
  }

Why are the next/last buttons enabled/disabled only if range is limited or if the row count isn't exact? I have a pager set to range limited false, and my data provider specifies that the row count is exact when I update the row count. With this setup, the next/last paging buttons will NEVER be updated!

Am I just using this wrong, or is it a bug?

I worked around the issue by subclassing SimplePager to allow me into that block at the bottom of onRangeOrRowCountChanged():

        @Override
        protected void onRangeOrRowCountChanged() {
            boolean rangeLimited = isRangeLimited();
            super.setRangeLimited(true);
            super.onRangeOrRowCountChanged();
            super.setRangeLimited(rangeLimited);
        }


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment