From 0db1a66aaa335a97c73152454f6b56b51eec97fb Mon Sep 17 00:00:00 2001
From: vitalets <noginsk@rambler.ru>
Date: Fri, 28 Jun 2013 00:54:41 +0400
Subject: [PATCH] add select2 destroy method

---
 src/inputs/abstract.js        | 2 +-
 src/inputs/select2/select2.js | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/inputs/abstract.js b/src/inputs/abstract.js
index 547ba10..ba040c3 100644
--- a/src/inputs/abstract.js
+++ b/src/inputs/abstract.js
@@ -155,7 +155,7 @@ To create your own input you can inherit from this class.
        /**
        Additional actions when destroying element 
        **/
-        destroy: function() {
+       destroy: function() {
        },
 
        // -------- helper functions --------
diff --git a/src/inputs/select2/select2.js b/src/inputs/select2/select2.js
index f73a601..fab2636 100644
--- a/src/inputs/select2/select2.js
+++ b/src/inputs/select2/select2.js
@@ -229,6 +229,12 @@ $(function(){
                 }
             }
             return source;            
+        },
+        
+        destroy: function() {
+            if(this.$input.data('select2')) {
+                this.$input.select2('destroy');
+            }
         }               
         
     });