Fix sorting for connectedWidth columns

This commit is contained in:
Hadi Nategh
2020-10-14 10:33:19 +02:00
parent 66c59a19f9
commit 71dabcd33b
2 changed files with 14 additions and 12 deletions

View File

@ -942,9 +942,10 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
*/
set_sortable(sortable: boolean | Function)
{
const $node = jQuery(this.getDOMNode());
if(!sortable)
{
this.tbody.sortable("destroy");
$node.sortable("destroy");
return;
}
@ -962,7 +963,7 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
const self = this;
// Set up sortable
this.tbody.sortable({
$node.sortable({
// Header does not participate in sorting
items: "tr:not(.th)",
distance: 15,
@ -971,20 +972,20 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
containment: this.options.sortable_containment,
connectWith: this.options.sortable_connectWith,
update: function(event, ui) {
self.egw().json(sortable,[self.tbody.sortable("toArray"), self.id],
self.egw().json(sortable,[$node.sortable("toArray"), self.id],
null,
self,
true
).sendRequest();
},
receive: function (event, ui) {
if (typeof self.options.sortable_recieveCallback == 'function') {
self.options.sortable_recieveCallback.call(self, event,ui);
if (typeof self.sortable_recieveCallback == 'function') {
self.sortable_recieveCallback.call(self, event, ui, self.id);
}
},
start: function (event, ui) {
if (typeof self.options.sortable_startCallback == 'function') {
self.options.sortable_startCallback.call(self, event,ui);
self.options.sortable_startCallback.call(self, event, ui, self.id);
}
}
});