Replace nm column jquery-ui sorting with sortablejs

This commit is contained in:
Hadi Nategh 2021-08-04 14:48:02 +02:00
parent 41ccb921be
commit 19135ab904
2 changed files with 14 additions and 25 deletions

View File

@ -2078,30 +2078,19 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
self.selectPopup = null; self.selectPopup = null;
}; };
const $select = jQuery(select.getDOMNode()); const $select = jQuery(select.getDOMNode());
$select.find('.ui-multiselect-checkboxes').sortable({
placeholder:'ui-fav-sortable-placeholder', //todo (todo-jquery-ui): fix the sortable import statement
items:'li[class^="selcolumn_sortable_col"]', import('../../../node_modules/sortablejs/Sortable.min.js').then(function(){
cancel: 'li[class^="selcolumn_sortable_#"]', let sortablejs = Sortable.create(select.getDOMNode().getElementsByClassName('ui-multiselect-checkboxes')[0], {
cursor: "move", ghostClass: 'ui-fav-sortable-placeholder',
tolerance: "pointer", draggable: 'li[class^="selcolumn_sortable_col"]',
axis: 'y', filter: 'li[class^="selcolumn_sortable_#"]',
containment: "parent", direction: 'vertical',
delay: 250, //(millisecond) delay before the sorting should start delay: 25,
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" );
}
}); });
}.bind(this));
$select.disableSelection(); $select.disableSelection();
$select.find('li[class^="selcolumn_sortable_"]').each(function(i,v){ $select.find('li[class^="selcolumn_sortable_"]').each(function(i,v){
// @ts-ignore // @ts-ignore

View File

@ -962,7 +962,7 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
} }
//todo: fix the sortable import statement //todo (todo-jquery-ui): fix the sortable import statement
import('../../../node_modules/sortablejs/Sortable.min.js').then(function(){ import('../../../node_modules/sortablejs/Sortable.min.js').then(function(){
this.sortablejs = new Sortable(tbody,{ this.sortablejs = new Sortable(tbody,{
group: this.options.sortable_connectWith, group: this.options.sortable_connectWith,