From 1211bc337e8a1f70e80eba90832ed6423583f3ee Mon Sep 17 00:00:00 2001 From: SzollosMarketvision Date: Mon, 18 Feb 2019 14:50:11 +0100 Subject: [PATCH 1/2] Speed up group selection --- assets/dist/datagrid.js | 45 ++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/assets/dist/datagrid.js b/assets/dist/datagrid.js index 80de4007..0ff9b31e 100644 --- a/assets/dist/datagrid.js +++ b/assets/dist/datagrid.js @@ -148,8 +148,9 @@ datagridShiftGroupSelection(); document.addEventListener('change', function(e) { - var checked_inputs, counter, event, grid, i, ie, input, inputs, len, results, select, total; + var checked_inputs, counter, event, grid, i, ie, input, inputs, len, select, total; grid = e.target.getAttribute('data-check'); + ie = window.navigator.userAgent.indexOf("MSIE "); if (grid) { checked_inputs = document.querySelectorAll('input[data-check-all-' + grid + ']:checked'); select = document.querySelector('.datagrid-' + grid + ' select[name="group_action[group_action]"]'); @@ -168,43 +169,37 @@ counter.innerHTML = ""; } } - } - ie = window.navigator.userAgent.indexOf("MSIE "); - if (ie) { - event = document.createEvent('Event'); - event.initEvent('change', true, true); - } else { - event = new Event('change', { - 'bubbles': true - }); - } - if (select) { + if (ie) { + event = document.createEvent('Event'); + event.initEvent('change', true, true); + } else { + event = new Event('change', { + 'bubbles': true + }); + } select.dispatchEvent(event); } } grid = e.target.getAttribute('data-check-all'); + if (ie) { + event = document.createEvent('Event'); + event.initEvent('change', true, true); + } else { + event = new Event('change', { + 'bubbles': true + }); + } if (grid) { inputs = document.querySelectorAll('input[type=checkbox][data-check-all-' + grid + ']'); - results = []; for (i = 0, len = inputs.length; i < len; i++) { input = inputs[i]; input.checked = e.target.checked; - ie = window.navigator.userAgent.indexOf("MSIE "); - if (ie) { - event = document.createEvent('Event'); - event.initEvent('change', true, true); - } else { - event = new Event('change', { - 'bubbles': true - }); - } - results.push(input.dispatchEvent(event)); } - return results; + input.dispatchEvent(event) } }); - + window.datagridSerializeUrl = function(obj, prefix) { var str = []; for(var p in obj) { From a764a2c8447fba7a881f330dc20ed4be33aed62e Mon Sep 17 00:00:00 2001 From: SzollosMarketvision Date: Mon, 18 Feb 2019 14:50:47 +0100 Subject: [PATCH 2/2] Tabs to spaces --- assets/dist/datagrid.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/assets/dist/datagrid.js b/assets/dist/datagrid.js index 0ff9b31e..24c4e6af 100644 --- a/assets/dist/datagrid.js +++ b/assets/dist/datagrid.js @@ -200,24 +200,24 @@ }); -window.datagridSerializeUrl = function(obj, prefix) { - var str = []; - for(var p in obj) { - if (obj.hasOwnProperty(p)) { - var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p]; - if (v !== null && v !== "") { - if (typeof v == "object") { - var r = window.datagridSerializeUrl(v, k); - if (r) { - str.push(r); - } - } else { - str.push(encodeURIComponent(k) + "=" + encodeURIComponent(v)); - } - } - } - } - return str.join("&"); + window.datagridSerializeUrl = function (obj, prefix) { + var str = []; + for (var p in obj) { + if (obj.hasOwnProperty(p)) { + var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p]; + if (v !== null && v !== "") { + if (typeof v == "object") { + var r = window.datagridSerializeUrl(v, k); + if (r) { + str.push(r); + } + } else { + str.push(encodeURIComponent(k) + "=" + encodeURIComponent(v)); + } + } + } + } + return str.join("&"); } ;