Author: jleroux
Date: Thu Nov 9 12:30:48 2017 New Revision: 1814723 URL: http://svn.apache.org/viewvc?rev=1814723&view=rev Log: Implemented: Framework: Remove inline js for toggleAll calling from ftls and also remove checkToggle, toggleAll and selectAll js functions Improved: (OFBIZ-8300) Remove inline js for toggleAll, checkToggle and selectAll calling from ftls in Framework component. Add class="selectAll" on parent checkbox element for select all functionality. Also remove js functions from OFBIZUtil.js. Functions are: toggleAll, selectAll, toggle and checkToggle, as all its usage replaced with generic selectAll class usage. Thanks: Amardeep Singh Jhajj and Aditya Sharma Modified: ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js Modified: ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl?rev=1814723&r1=1814722&r2=1814723&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl (original) +++ ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl Thu Nov 9 12:30:48 2017 @@ -820,7 +820,7 @@ Parameter: delegatorName, String, option <#macro renderHyperlinkTitle name title showSelectAll="N"> <#if title?has_content>${title}<br /></#if> - <#if showSelectAll="Y"><input type="checkbox" name="selectAll" value="Y" onclick="javascript:toggleAll(this, '${name}');"/></#if> + <#if showSelectAll="Y"><input type="checkbox" name="selectAll" value="Y" class="selectAll"/></#if> </#macro> <#macro renderSortField style title linkUrl ajaxEnabled tooltip=""> Modified: ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js?rev=1814723&r1=1814722&r2=1814723&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js (original) +++ ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js Thu Nov 9 12:30:48 2017 @@ -130,60 +130,6 @@ jQuery.fn.getForm = function() { } } -// Check Box Select/Toggle Functions for Select/Toggle All - -function toggle(e) { - e.checked = !e.checked; -} - -function checkToggleDefault(e) { - checkToggle(e, "selectAllForm"); -} -function checkToggle(e, formName) { - var cform = document[formName]; - if (e.checked) { - var len = cform.elements.length; - var allchecked = true; - for (var i = 0; i < len; i++) { - var element = cform.elements[i]; - if (element.name.substring(0, 10) == "_rowSubmit" && !element.checked) { - allchecked = false; - } - cform.selectAll.checked = allchecked; - } - } else { - cform.selectAll.checked = false; - } -} - -function toggleAllDefault(e) { - toggleAll(e, "selectAllForm"); -} -function toggleAll(e, formName) { - var cform = document[formName]; - var len = cform.elements.length; - for (var i = 0; i < len; i++) { - var element = cform.elements[i]; - if (element.name.substring(0, 10) == "_rowSubmit" && element.checked != e.checked) { - toggle(element); - } - } -} - -function selectAllDefault() { - selectAll("selectAllForm"); -} -function selectAll(formName) { - var cform = document[formName]; - var len = cform.elements.length; - for (var i = 0; i < len; i++) { - var element = cform.elements[i]; - if ((element.name == "selectAll" || element.name.substring(0, 10) == "_rowSubmit") && !element.checked) { - toggle(element); - } - } -} - function removeSelectedDefault() { removeSelected("selectAllForm"); } |
Free forum by Nabble | Edit this page |