From 1f299b52e0571d01cd9b15ae53ec60ca099c18fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Tue, 27 Nov 2007 13:10:24 +0000 Subject: #195073 by yched and quicksketch: allow multiple drag and drop utilizing tables to be used on the same page (small bug fix) --- misc/tabledrag.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'misc/tabledrag.js') diff --git a/misc/tabledrag.js b/misc/tabledrag.js index 797113332..e1a56f974 100644 --- a/misc/tabledrag.js +++ b/misc/tabledrag.js @@ -87,8 +87,8 @@ Drupal.tableDrag = function(table, tableSettings) { // Add mouse bindings to the document. The self variable is passed along // as event handlers do not have direct access to the tableDrag object. - $(document).bind('mousemove', { tableDrag: self }, self.dragRow); - $(document).bind('mouseup', { tableDrag: self }, self.dropRow); + $(document).bind('mousemove', function(event) { self.dragRow(event, self); }); + $(document).bind('mouseup', function(event) { self.dropRow(event, self); }); }; /** @@ -240,7 +240,7 @@ Drupal.tableDrag.prototype.makeDraggable = function(item) { $(this).removeClass('tabledrag-handle-hover'); if (self.rowObject && self.safeBlur) { event.data = { tableDrag: self }; - self.dropRow(event); + self.dropRow(event, self); } }); @@ -341,9 +341,7 @@ Drupal.tableDrag.prototype.makeDraggable = function(item) { /** * Mousemove event handler, bound to document. */ -Drupal.tableDrag.prototype.dragRow = function(event) { - var self = event.data.tableDrag; - +Drupal.tableDrag.prototype.dragRow = function(event, self) { if (self.dragObject) { self.currentMouseCoords = self.mouseCoords(event); @@ -405,9 +403,7 @@ Drupal.tableDrag.prototype.dragRow = function(event) { * Mouseup event handler, bound to document. * Blur event handler, bound to drag handle for keyboard support. */ -Drupal.tableDrag.prototype.dropRow = function(event) { - var self = event.data.tableDrag; - +Drupal.tableDrag.prototype.dropRow = function(event, self) { // Drop row functionality shared between mouseup and blur events. if (self.rowObject != null) { var droppedRow = self.rowObject.element; -- cgit v1.2.3