From 3c374f7803c3528d598fc50aec037de220eee39e Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 25 Nov 2019 13:37:24 +0100 Subject: [PATCH] Fix scrolling a sorting item breaks the sorting in colSelector dialog --- api/js/etemplate/et2_extension_nextmatch.js | 24 +++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 1a187425c6..ce28b92a2a 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -1560,11 +1560,31 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_ self.selectPopup = null; }; var $select = jQuery(select.getDOMNode()); - $select.sortable({ - items:'li[class^="selcolumn_sortable_col_"]', + $select.find('.ui-multiselect-checkboxes').sortable({ placeholder:'ui-fav-sortable-placeholder', + items:'li[class^="selcolumn_sortable_col"]', + cancel: 'li[class^="selcolumn_sortable_#"]', + cursor: "move", + tolerance: "pointer", + axis: 'y', + containment: "parent", delay: 250, //(millisecond) delay before the sorting should start + beforeStop: function(event, ui) { + jQuery('li[class^="selcolumn_sortable_#"]', this).css({ + opacity: 1 + }); + }, + start: function(event, ui){ + jQuery('li[class^="selcolumn_sortable_#"]', this).css({ + opacity: 0.5 + }); + }, + sort: function (event, ui) + { + jQuery( this ).sortable("refreshPositions" ); + } }); + $select.disableSelection(); $select.find('li[class^="selcolumn_sortable_"]').each(function(i,v){ jQuery(v).attr('data-value',(jQuery(v).find('input')[0].value)) });