The following comment has been added to this issue: Author: Wannes Simons Created: Wed, 2 Feb 2005 6:33 AM Body: Actually the code to go to the previous page is this: ---------------------------------------------- // invalid page requested, go back to the previous page while (start >= fullSize){ start = Math.max( start - this.pagesize, 0 ); this.pageNumber--; } ----------------------------------------------- --------------------------------------------------------------------- View this comment: http://jira.codehaus.org/browse/DISPL-182?page=comments#action_29503
--------------------------------------------------------------------- View the issue: http://jira.codehaus.org/browse/DISPL-182 Here is an overview of the issue: --------------------------------------------------------------------- Key: DISPL-182 Summary: Empty list displayed when start offset == list length Type: Bug Status: Unassigned Priority: Minor Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: DisplayTag Components: Paging/Sorting Versions: 1.0 Assignee: Reporter: Wannes Simons Created: Wed, 2 Feb 2005 6:07 AM Updated: Wed, 2 Feb 2005 6:33 AM Description: In the unfortunate event that the starting offset is the same as the number of items in the list, an empty page is shown. This error occurs when the page number is saved in the session (using a custom RequestHelper) and the last item on the page is deleted. E.g. there are two pages and the last item on the second page is deleted. The pagenumber is still '2', but all items are shown on the first page, so the result is an empty list. The fix is very easy. In the TableTag, the initParameters() method, the invalid page check should be this: ---------------------------------------------- // invalid page requested, go back to page one if (start >= fullSize){ start = 0; } ----------------------------------------------- As you can see; when start == fullSize, start has to be changed as well, because there should be at least 1 item on each page. Theoretically this should work as well: ---------------------------------------------- // invalid page requested, go back to the previous page while (start >= fullSize){ start = Math.max( start - this.pagesize, 0 ); } ----------------------------------------------- Making it go to the previous page, instead of the first in the list. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ displaytag-devel mailing list displaytag-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-devel