[OFBIZ-5778] Add pagination to picklists screen. This simple change helps when we have big list of picklist.
Thanks Arun Patidar for load tests, reporting issue and providing fix. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1626436 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1213,6 +1213,8 @@ under the License.
|
||||
</check-permission>
|
||||
<check-errors/>
|
||||
|
||||
<set field="viewSize" from-field="parameters.viewSize" type="Integer"/>
|
||||
<set field="viewIndex" from-field="parameters.viewIndex" type="Integer"/>
|
||||
<entity-condition entity-name="Picklist" list="picklistList">
|
||||
<condition-list combine="and">
|
||||
<condition-expr field-name="facilityId" operator="equals" from-field="parameters.facilityId"/>
|
||||
@@ -1220,14 +1222,36 @@ under the License.
|
||||
<condition-expr field-name="statusId" operator="not-equals" value="PICKLIST_CANCELLED"/>
|
||||
</condition-list>
|
||||
<order-by field-name="picklistDate"/>
|
||||
<limit-view view-size="${viewSize}" view-index="${viewIndex+1}"/>
|
||||
</entity-condition>
|
||||
|
||||
<entity-count entity-name="Picklist" count-field="picklistCount">
|
||||
<condition-list combine="and">
|
||||
<condition-expr field-name="facilityId" operator="equals" from-field="parameters.facilityId"/>
|
||||
<condition-expr field-name="statusId" operator="not-equals" value="PICKLIST_PICKED"/>
|
||||
<condition-expr field-name="statusId" operator="not-equals" value="PICKLIST_CANCELLED"/>
|
||||
</condition-list>
|
||||
</entity-count>
|
||||
<iterate entry="picklist" list="picklistList">
|
||||
<call-simple-method method-name="getPicklistSingleInfoInline"/>
|
||||
<field-to-list field="picklistInfo" list="picklistInfoList"/>
|
||||
</iterate>
|
||||
|
||||
<set field="lowIndex" value="${(viewIndex * viewSize) + 1}" type="Integer"/>
|
||||
<set field="highIndex" value="${(viewIndex + 1) * viewSize}" type="Integer"/>
|
||||
<if-compare-field field="highIndex" operator="greater" to-field="picklistCount" type="Integer">
|
||||
<set field="highIndex" from-field="picklistCount" type="Integer"/>
|
||||
</if-compare-field>
|
||||
<if-compare-field field="viewSize" operator="greater" to-field="picklistCount" type="Integer">
|
||||
<set field="highIndex" from-field="picklistCount" type="Integer"/>
|
||||
</if-compare-field>
|
||||
|
||||
<field-to-result field="picklistInfoList"/>
|
||||
<field-to-result field="viewIndex"/>
|
||||
<field-to-result field="viewSize"/>
|
||||
<field-to-result field="lowIndex"/>
|
||||
<field-to-result field="highIndex"/>
|
||||
<field-to-result field="picklistCount"/>
|
||||
</simple-method>
|
||||
|
||||
<simple-method method-name="getPickAndPackReportInfo" short-description="getPickAndPackReportInfo">
|
||||
|
||||
@@ -79,6 +79,11 @@ under the License.
|
||||
location="component://product/script/org/ofbiz/shipment/picklist/PicklistServices.xml" invoke="getPicklistDisplayInfo">
|
||||
<description>Create Picklist From Orders</description>
|
||||
<attribute name="facilityId" type="String" mode="IN" optional="false"/>
|
||||
<attribute name="viewIndex" mode="INOUT" type="Integer" optional="true"/>
|
||||
<attribute name="viewSize" mode="INOUT" type="Integer" optional="true"/>
|
||||
<attribute name="highIndex" mode="OUT" type="Integer" optional="true"/>
|
||||
<attribute name="lowIndex" mode="OUT" type="Integer" optional="true"/>
|
||||
<attribute name="picklistCount" mode="OUT" type="Long" optional="true"/>
|
||||
<attribute name="picklistInfoList" type="List" mode="OUT" optional="true"/>
|
||||
</service>
|
||||
|
||||
|
||||
@@ -16,14 +16,41 @@ KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
function paginateOrderList(viewSize, viewIndex) {
|
||||
document.paginationForm.viewSize.value = viewSize;
|
||||
document.paginationForm.viewIndex.value = viewIndex;
|
||||
document.paginationForm.submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="screenlet">
|
||||
<div class="screenlet-title-bar">
|
||||
<ul>
|
||||
<li class="h3">${uiLabelMap.ProductPicklistManage}</li>
|
||||
<#if (picklistInfoList?has_content && 0 < picklistInfoList?size)>
|
||||
<#if (picklistCount > highIndex)>
|
||||
<li><a href="javascript:paginateOrderList('${viewSize}', '${viewIndex+1}')">${uiLabelMap.CommonNext}</a></li>
|
||||
<#else>
|
||||
<li><span class="disabled">${uiLabelMap.CommonNext}</span></li>
|
||||
</#if>
|
||||
<#if (picklistCount > 0)>
|
||||
<li><span>${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${picklistCount}</span></li>
|
||||
</#if>
|
||||
<#if (viewIndex > 0)>
|
||||
<li><a href="javascript:paginateOrderList('${viewSize}', '${viewIndex-1}')">${uiLabelMap.CommonPrevious}</a></li>
|
||||
<#else>
|
||||
<li><span class="disabled">${uiLabelMap.CommonPrevious}</span></li>
|
||||
</#if>
|
||||
</#if>
|
||||
</ul>
|
||||
<br class="clear"/>
|
||||
</div>
|
||||
<form name="paginationForm" method="post" action="<@ofbizUrl>PicklistManage</@ofbizUrl>">
|
||||
<input type="hidden" name="viewSize" value="${viewSize}"/>
|
||||
<input type="hidden" name="viewIndex" value="${viewIndex}"/>
|
||||
<input type="hidden" name="facilityId" value="${facilityId}"/>
|
||||
</form>
|
||||
<div class="screenlet-body">
|
||||
<#if picklistInfoList?has_content>
|
||||
<#list picklistInfoList as picklistInfo>
|
||||
|
||||
@@ -1247,6 +1247,8 @@ under the License.
|
||||
<set field="tabButtonItem" value="PicklistManage"/>
|
||||
|
||||
<set field="facilityId" from-field="parameters.facilityId"/>
|
||||
<set field="viewIndex" from-field="parameters.viewIndex" default-value="0"/>
|
||||
<set field="viewSize" from-field="parameters.viewSize" default-value="10"/>
|
||||
<service service-name="getPicklistDisplayInfo">
|
||||
<field-map field-name="facilityId"/>
|
||||
</service>
|
||||
|
||||
Reference in New Issue
Block a user