From 1a2cacc2cddfda1d3d5da353adb60b93b3218cdb Mon Sep 17 00:00:00 2001 From: Jacopo Cappellato Date: Fri, 24 Nov 2006 08:55:00 +0000 Subject: [PATCH] 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 --- .../party/src/org/ofbiz/party/party/PartyServices.java | 10 +++++----- applications/party/webapp/partymgr/party/findparty.ftl | 6 ++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/applications/party/src/org/ofbiz/party/party/PartyServices.java b/applications/party/src/org/ofbiz/party/party/PartyServices.java index 9c255fce5e..f4c512a6fd 100644 --- a/applications/party/src/org/ofbiz/party/party/PartyServices.java +++ b/applications/party/src/org/ofbiz/party/party/PartyServices.java @@ -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) { diff --git a/applications/party/webapp/partymgr/party/findparty.ftl b/applications/party/webapp/partymgr/party/findparty.ftl index aca0e9e261..b1485c35a5 100644 --- a/applications/party/webapp/partymgr/party/findparty.ftl +++ b/applications/party/webapp/partymgr/party/findparty.ftl @@ -208,14 +208,12 @@ function refreshInfo() {
<#if (partyListSize > 0)> - <#if (viewIndex > 1)> + <#if (viewIndex > 0)> " class="submenutext">${uiLabelMap.CommonPrevious} <#else> ${uiLabelMap.CommonPrevious} - <#if (partyListSize > 0)> - ${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${partyListSize} - + ${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${partyListSize} <#if (partyListSize > highIndex)> " class="submenutextright">${uiLabelMap.CommonNext} <#else>