From 4745fb294e782e4d541d5845bdc5092ef8b3f388 Mon Sep 17 00:00:00 2001 From: AndreasGalster Date: Sat, 12 Mar 2016 22:28:19 +0800 Subject: [PATCH] Added methods to re-initialize and destroy sortable Moved attached initialization of sortable into a method and run that method on attached. Did the same for detached and created a destroy method. --- Sortable.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sortable.html b/Sortable.html index 82ec380..e6d6b6e 100644 --- a/Sortable.html +++ b/Sortable.html @@ -61,9 +61,10 @@ }, detached: function() { - this.sortable.destroy() + this.destroy() }, + initialize: function() { var templates = this.querySelectorAll("template[is='dom-repeat']") @@ -122,6 +123,12 @@ }, + destroy: function() { + if(this.sortable) { + this.sortable.destroy() + } + }, + groupChanged : function(value) { this.sortable && this.sortable.option("group", value) }, sortChanged : function(value) { this.sortable && this.sortable.option("sort", value) }, disabledChanged : function(value) { this.sortable && this.sortable.option("disabled", value) },