From 1032e7303abe2b7fcf29c207aee41f7c417917f6 Mon Sep 17 00:00:00 2001 From: Brandon Aaron Date: Tue, 12 Aug 2014 17:27:23 -0400 Subject: [PATCH] Bind the drag related events in render instead of on init so that they are rebound after being unbound by destroy. --- src/common/View.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/common/View.js b/src/common/View.js index cdafdb2..048a615 100644 --- a/src/common/View.js +++ b/src/common/View.js @@ -45,10 +45,9 @@ View.prototype = { this.widgetContentClass = tm + '-widget-content'; this.highlightStateClass = tm + '-state-highlight'; - // save reference to `this`-bound handlers and attach to document - $(document) - .on('mousedown', this.documentMousedownProxy = $.proxy(this, 'documentMousedown')) - .on('dragstart', this.documentDragStartProxy = $.proxy(this, 'documentDragStart')); // jqui drag + // save references to `this`-bound handlers + this.documentMousedownProxy = $.proxy(this, 'documentMousedown'); + this.documentDragStartProxy = $.proxy(this, 'documentDragStart'); }, @@ -57,6 +56,11 @@ View.prototype = { render: function() { this.updateSize(); this.trigger('viewRender', this, this, this.el); + + // attach handlers to document. do it here to allow for destroy/rerender + $(document) + .on('mousedown', this.documentMousedownProxy) + .on('dragstart', this.documentDragStartProxy); // jqui drag },