Author: jleroux
Date: Sat Sep 19 19:53:47 2015 New Revision: 1704082 URL: http://svn.apache.org/viewvc?rev=1704082&view=rev Log: A patch from Gil Portenseigne for "multiple select dropdown listbox shows only one entry" https://issues.apache.org/jira/browse/OFBIZ-6627 Wai reported: Use this link https://localhost:8443/ordermgr/control/FindRequest Notice the customer request type id, status id, etc This patch extend existing asm dropdown implementation to allow several asm dropdown in the same form using a simple ftl. Find Request use the new ftl in this example. Added: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJsList.ftl (with props) Modified: ofbiz/trunk/applications/order/widget/ordermgr/CustRequestScreens.xml Modified: ofbiz/trunk/applications/order/widget/ordermgr/CustRequestScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/CustRequestScreens.xml?rev=1704082&r1=1704081&r2=1704082&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/CustRequestScreens.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/CustRequestScreens.xml Sat Sep 19 19:53:47 2015 @@ -26,6 +26,24 @@ under the License. <set field="titleProperty" value="OrderFindRequests"/> <set field="headerItem" value="request"/> <set field="entityName" value="CustRequest"/> + <set field="asm_multipleSelectForm" value="FindRequests"/> + <set field="asm_asmListItemPercentOfForm" value="110"/> + <set field="custRequestType.asm_multipleSelect" value="FindRequests_custRequestTypeId"/> + <set field="custRequestType.asm_sortable" value="true"/> + <set field="custRequestType.asm_title" value=" "/> + <set field="statusId.asm_multipleSelect" value="FindRequests_statusId"/> + <set field="statusId.asm_sortable" value="true"/> + <set field="statusId.asm_title" value=" "/> + <set field="productStoreId.asm_multipleSelect" value="FindRequests_productStoreId"/> + <set field="productStoreId.asm_sortable" value="true"/> + <set field="productStoreId.asm_title" value=" "/> + <set field="salesChannelEnumId.asm_multipleSelect" value="FindRequests_salesChannelEnumId"/> + <set field="salesChannelEnumId.asm_sortable" value="true"/> + <set field="salesChannelEnumId.asm_title" value=" "/> + <set field="asm_listField[]" from-field="custRequestType"/> + <set field="asm_listField[]" from-field="statusId"/> + <set field="asm_listField[]" from-field="productStoreId"/> + <set field="asm_listField[]" from-field="salesChannelEnumId"/> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> @@ -37,6 +55,7 @@ under the License. </container> </decorator-section> <decorator-section name="search-options"> + <platform-specific><html><html-template location="component://common/webcommon/includes/setMultipleSelectJsList.ftl"/></html></platform-specific> <include-form name="FindRequests" location="component://order/widget/ordermgr/CustRequestForms.xml"/> </decorator-section> <decorator-section name="search-results"> Added: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJsList.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJsList.ftl?rev=1704082&view=auto ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJsList.ftl (added) +++ ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJsList.ftl Sat Sep 19 19:53:47 2015 @@ -0,0 +1,66 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<#if asm_listField??> <#-- we check only this var and suppose the others are also present --> + <#list asm_listField as row> + <#if row.asm_multipleSelect??> + <script type="text/javascript"> + jQuery(document).ready(function() { + multiple = jQuery("#${row.asm_multipleSelect!}"); + + <#if row.asm_title??> + // set the dropdown "title" if?? + multiple.attr('title', '${row.asm_title}'); + </#if> + + // use asmSelect in Widget Forms + multiple.asmSelect({ + addItemTarget: 'top', + sortable: ${row.asm_sortable!'false'}, + removeLabel: '${uiLabelMap.CommonRemove!'Remove'}' + //, debugMode: true + }); + + <#if row.asm_relatedField??> <#-- can be used without related field --> + // track possible relatedField changes + // on initial focus (focus-field-name must be asm_relatedField) or if the field value changes, select related multi values. + typeValue = jQuery('#${row.asm_typeField}').val(); + jQuery("#${row.asm_relatedField}").one('focus', function() { + selectMultipleRelatedValues('${row.asm_requestName}', '${row.asm_paramKey}', '${row.asm_relatedField}', '${row.asm_multipleSelect}', '${row.asm_type}', typeValue, '${row.asm_responseName}'); + }); + jQuery("#${row.asm_relatedField}").change(function() { + selectMultipleRelatedValues('${row.asm_requestName}', '${row.asm_paramKey}', '${row.asm_relatedField}', '${row.asm_multipleSelect}', '${row.asm_type}', typeValue, '${row.asm_responseName}'); + }); + selectMultipleRelatedValues('${row.asm_requestName}', '${row.asm_paramKey}', '${row.asm_relatedField}', '${row.asm_multipleSelect}', '${row.asm_type}', typeValue, '${row.asm_responseName}'); + </#if> + }); + </script> + + </#if> + </#list> + <style type="text/css"> + #${asm_multipleSelectForm} { + width: ${asm_formSize!700}px; + position: relative; + } + + .asmListItem { + width: ${asm_asmListItemPercentOfForm!95}%; + } + </style> +</#if> Propchange: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJsList.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJsList.ftl ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJsList.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain |
Free forum by Nabble | Edit this page |