Paging broken due to wrong offset calculation
---------------------------------------------
Key: MGNLSTK-744
URL: http://jira.magnolia-cms.com/browse/MGNLSTK-744
Project: Magnolia Standard Templating Kit
Issue Type: Bug
Affects Versions: 1.4.2
Environment: all systems
Reporter: Frank Rittinger
Assignee: Philipp Bärfuss
Priority: Major
STKPager calculates wrong sublist for display due to an error in the offset
calculation. This was introduced by the update from 1.4.1 to 1.4.2:
{noformat}
protected int getOffset() {
int offset = ((getCurrentPage()) * maxResultsPerPage) -1;
if(offset > count) {
int pages = count / maxResultsPerPage;
offset = pages * maxResultsPerPage;
}
return offset;
}
{noformat}
should be
{noformat}
protected int getOffset() {
int offset = (getCurrentPage() - 1) * maxResultsPerPage;
if(offset > count) {
int pages = count / maxResultsPerPage;
offset = pages * maxResultsPerPage;
}
return offset;
}
{noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------