Changed the pagination handling in the findParty service to be consistent with the form widget's pagination.

Based on suggestion from Illya Kysil (OFBIZ-371).


git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@478807 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacopo Cappellato
2006-11-24 08:55:00 +00:00
parent b390926da6
commit 1a2cacc2cd
2 changed files with 7 additions and 9 deletions
@@ -990,11 +990,11 @@ public class PartyServices {
}
// set the page parameters
int viewIndex = 1;
int viewIndex = 0;
try {
viewIndex = Integer.parseInt((String) context.get("VIEW_INDEX"));
} catch (Exception e) {
viewIndex = 1;
viewIndex = 0;
}
result.put("viewIndex", new Integer(viewIndex));
@@ -1285,8 +1285,8 @@ public class PartyServices {
EntityListIterator pli = delegator.findListIteratorByCondition(dynamicView, mainCond, null, fieldsToSelect, orderBy, findOpts);
// get the indexes for the partial list
lowIndex = (((viewIndex - 1) * viewSize) + 1);
highIndex = viewIndex * viewSize;
lowIndex = viewIndex * viewSize + 1;
highIndex = (viewIndex + 1) * viewSize;
// get the partial list for this page
partyList = pli.getPartialList(lowIndex, viewSize);
@@ -1297,7 +1297,7 @@ public class PartyServices {
if (highIndex > partyListSize) {
highIndex = partyListSize;
}
// close the list iterator
pli.close();
} catch (GenericEntityException e) {
@@ -208,14 +208,12 @@ function refreshInfo() {
<td width="50%">
<div class="boxhead" align="right">
<#if (partyListSize > 0)>
<#if (viewIndex > 1)>
<#if (viewIndex > 0)>
<a href="<@ofbizUrl>findparty?VIEW_SIZE=${viewSize}&amp;VIEW_INDEX=${viewIndex-1}&amp;hideFields=${parameters.hideFields?default("N")}${paramList}</@ofbizUrl>" class="submenutext">${uiLabelMap.CommonPrevious}</a>
<#else>
<span class="submenutextdisabled">${uiLabelMap.CommonPrevious}</span>
</#if>
<#if (partyListSize > 0)>
<span class="submenutextinfo">${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${partyListSize}</span>
</#if>
<span class="submenutextinfo">${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${partyListSize}</span>
<#if (partyListSize > highIndex)>
<a href="<@ofbizUrl>findparty?VIEW_SIZE=${viewSize}&amp;VIEW_INDEX=${viewIndex+1}&amp;hideFields=${parameters.hideFields?default("N")}${paramList}</@ofbizUrl>" class="submenutextright">${uiLabelMap.CommonNext}</a>
<#else>