Hi,
to avoid this issue, you have to override the
setPageStart(int index) method in the AbstractPager class.
with the following code:
/**
* Set the page start index.
*
* @param index the index
* @see #getPageStart()
*/
protected void setPageStart(int index) {
if (display != null) {
display.setVisibleRange(index,
display.getVisibleRange().getLength());
}
}
This code will set the startindex of the page as expected. But be
careful the size of the CellTable will be reduce, because you have
less rows!
On 10 Nov., 08:09, vaibhav gwt <[email protected]> wrote:
> Hi
> I am using GWT2.3 Celltable
>
> I'm using SimplePager and I want to show 11 items(users) perpage.
> 1 empty records + 10 actual records = 11 records perpageso
> PageSize=11
>
> All my data is 36 items. I want to show text in Simplepagersuch way
> thatPagershould display following values in mypagerwhen PageSize=11 (I
> am setting 1 empty record in grid)
> i.e 1-10 of 36 11-20 of 36 21-30 of 36 31-36 of 36
>
> Currently I am getting lots of issue likelast pageshowing
> unexpected records. (expected 7 = 1 empty + 6 actual records)pagershowing
> unexpected startIndex ,lastIndex and
> dataSize(totalRecordCount)
>
> I am stuck in thispager issue.
>
> Any help or guidance in this matter would be appreciated
>
> Does anyone know what's going wrong?
>
> On Apr 27, 8:03 pm, "[email protected]"
>
>
>
>
>
>
>
> <[email protected]> wrote:
> > I fixed the bug with the invalid enabled "nextpage" button while
> > setting setRangeLimited(false) by overwriting the hasNextPage()
> > method:
>
> > /* (non-Javadoc)
> > * @see
> > com.google.gwt.user.cellview.client.SimplePager#hasNextPage()
> > */
> > @Override
> > public boolean hasNextPage() {
>
> > if(this.getPage()<(this.getPageCount()-1)) {
> > return true;
> > }
> > return false;
> > }
>
> > On Apr 6, 8:32 pm, Patrick Tucker <[email protected]>
> > wrote:
>
> > > It seems my original reply didn't get recorded properly, so I will try
> > > again with less detail...
>
> > > I noticed that if you call setRangeLimited(false), you get the behavior
> > > that
> > > you expect, but the forward buttons do not get grayed out.
>
> > > If you look at setPageStart(int) is uses isRangeLimited and display's
> > > isRowCountExact() values to determine whether or not pageSize records
> > > should
> > > be shown. If both are true you will get yourpageof pageSize. It seems to
> > > me that if isRangeLimited, meaning "whether or not thepagerange should be
> > > limited to the actual data", is true you would want to only see the 5
> > > remaining records instead of a fullpageof pageSize records.
>
> > > So what I did was copy AbstractPager into my project and change
> > > isRangeLimited to !isRangeLimited in setPageStart(int). See code below:
> > > protected void setPageStart(int index) {
> > > if (display != null) {
> > > Range range = display.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()) {
> > > display.setVisibleRange(index, pageSize);
> > > }
> > > }
> > > }
>
> > > You could also extend SimplePager and accomplish the same thing...
>
> > > Can someone from the GWT team comment on this?
>
> > > Thanks,
> > > Pat
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.