
| Key: |
DISPL-213
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Priority: |
Critical
|
| Reporter: |
Peter Luttrell
|
| Votes: |
1
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
DisplayTag
Created: 13/May/05 03:01 PM
Updated: 07/Sep/07 06:33 AM
|
|
| Component/s: |
Paging/Sorting
|
| Affects Version/s: |
1.0
|
| Fix Version/s: |
1.1
|
|
|
Depending on the number of results for which DisplayTag is paginating, the last page is often NOT displayed.
For example if you're paginating 110 results in pages of 10 you should get 11 pages, but only 10 show up. You can get to the 11th page by hitting last - it's just not showing up in the list of pages. Another example is 220 paginated by 20.
I have modified example-paging.jsp to show the problem.
<%@ include file="inc/header.jsp" %>
<% Object foo = request.getAttribute( "test" );
if( foo == null ) {
request.setAttribute( "test", new TestList(110, false) );
}
%>
<h2>Here's a test of 110 in pages of 10</h2>
<display:table name="requestScope.test" pagesize="10">
<display:column property="id" title="ID" />
<display:column property="name" />
<display:column property="email" />
<display:column property="status" />
</display:table>
<%@ include file="inc/footer.jsp" %>
|
|
Description
|
Depending on the number of results for which DisplayTag is paginating, the last page is often NOT displayed.
For example if you're paginating 110 results in pages of 10 you should get 11 pages, but only 10 show up. You can get to the 11th page by hitting last - it's just not showing up in the list of pages. Another example is 220 paginated by 20.
I have modified example-paging.jsp to show the problem.
<%@ include file="inc/header.jsp" %>
<% Object foo = request.getAttribute( "test" );
if( foo == null ) {
request.setAttribute( "test", new TestList(110, false) );
}
%>
<h2>Here's a test of 110 in pages of 10</h2>
<display:table name="requestScope.test" pagesize="10">
<display:column property="id" title="ID" />
<display:column property="name" />
<display:column property="email" />
<display:column property="status" />
</display:table>
<%@ include file="inc/footer.jsp" %>
|
Show » |
|
I think i found the problem for this issue.
The bug lies in the Class org.displaytag.pagination.SmartListHelper in the method getPageNavigationBar(Href baseHref, String pageParameter):
This method generates the navigationbar.
While computing the startPage there is a little mistake:
The line:
startPage =
Math.max(Math.min(this.currentPage - groupSize / 2, this.pageCount - groupSize),1);
has to be changed to:
startPage =
Math.max(Math.min(this.currentPage - groupSize / 2, this.pageCount - groupSize + 1),1);
I tried it and it works fine.
Regards
Markus