diff --git a/api/js/etemplate/et2_widget_grid.js b/api/js/etemplate/et2_widget_grid.js index d2018d8ea9..6fca8b7200 100644 --- a/api/js/etemplate/et2_widget_grid.js +++ b/api/js/etemplate/et2_widget_grid.js @@ -688,8 +688,9 @@ var et2_grid = /** @class */ (function (_super) { * @param {boolean|function} sortable Callback or false to disable */ et2_grid.prototype.set_sortable = function (sortable) { + var $node = jQuery(this.getDOMNode()); if (!sortable) { - this.tbody.sortable("destroy"); + $node.sortable("destroy"); return; } // Make sure rows have IDs, so sortable has something to return @@ -704,7 +705,7 @@ var et2_grid = /** @class */ (function (_super) { }); var self = this; // Set up sortable - this.tbody.sortable({ + $node.sortable({ // Header does not participate in sorting items: "tr:not(.th)", distance: 15, @@ -713,16 +714,16 @@ var et2_grid = /** @class */ (function (_super) { containment: this.options.sortable_containment, connectWith: this.options.sortable_connectWith, update: function (event, ui) { - self.egw().json(sortable, [self.tbody.sortable("toArray"), self.id], null, self, true).sendRequest(); + 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); } } }); diff --git a/api/js/etemplate/et2_widget_grid.ts b/api/js/etemplate/et2_widget_grid.ts index 258dc4c5dd..1fcf73394e 100644 --- a/api/js/etemplate/et2_widget_grid.ts +++ b/api/js/etemplate/et2_widget_grid.ts @@ -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); } } });