Re: Last Page too big in SimplePager
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 bhalke.vaib...@gmail.com 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, bstockiph...@googlemail.com bstockiph...@googlemail.com 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 patrick.tuc...@macefusion.com 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 google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Last Page too big in SimplePager
Hi I am using GWT2.3 Celltable I'm using SimplePager and I want to show 11 items(users) per page. 1 empty records + 10 actual records = 11 records per page so PageSize=11 All my data is 36 items. I want to show text in Simple pager such way that Pager should display following values in my pager when 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 like last page showing unexpected records. (expected 7 = 1 empty + 6 actual records) pager showing unexpected startIndex ,lastIndex and dataSize(totalRecordCount) I am stuck in this pager issue. Any help or guidance in this matter would be appreciated Does anyone know what's going wrong? On Apr 27, 8:03 pm, bstockiph...@googlemail.com bstockiph...@googlemail.com 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 patrick.tuc...@macefusion.com 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 google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Last Page too big in SimplePager
I fixed the bug with the wrongly enabled forward button when setting setRangeLimited(false); with this override: @Override public boolean hasNextPage() { if(this.getPage()(this.getPageCount()-1)) { return true; } return false; } -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Last Page too big in SimplePager
I fixed the problem with the enabled forward button when setting setRangeLimited(false) with this override: @Override public boolean hasNextPage() { if(this.getPage()(this.getPageCount()-1)) { return true; } return false; } -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Last Page too big in SimplePager
I fixed the bug with the invalid enabled next page 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 patrick.tuc...@macefusion.com 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 your page of pageSize. It seems to me that if isRangeLimited, meaning whether or not the page range should be limited to the actual data, is true you would want to only see the 5 remaining records instead of a full page of 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 google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Last Page too big in SimplePager
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 your page of pageSize. It seems to me that if isRangeLimited, meaning whether or not the page range should be limited to the actual data, is true you would want to only see the 5 remaining records instead of a full page of 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 google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Last Page too big in SimplePager
I use the SimplePager to page my CellTable. I have setup an AsyncDataProvider for the data but know beforehand how many rows there will be All the pages display fine, but the last. It is as big as the other. If I have a PageSize of 10 with 15 elements, the last page shows elements 6 through 15. I'd prefer to have only 11 through 15 shown. The solution I came up with, is to add the following lines of code to onRangeChanged in my AsyncDataProvider: int start = range.getStart(); int maxRows = form.getFormDataCount().get(formDataState); if(start + range.getLength() == maxRows) { start = maxRows - (range.getLength() - (start % range.getLength())); display.setVisibleRange(start, maxRows - start); } And I call my data provider with the new start and size parameters this does the trick but I'm sure there is a better solution -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.