Roo/bootstrap/CardUploader.js
[roojs1] / Roo / bootstrap / CardUploader.js
index b6a0f39..21dee55 100644 (file)
@@ -279,7 +279,8 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input,  {
                 
             }
         );
-        this.items.push(cn);
+        // dont' really need ot update items.
+        // this.items.push(cn);
         this.fileCollection.add(cn);
         
     },
@@ -288,9 +289,26 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input,  {
         
         var card  = this.fileCollection.get(id);
         this.fileCollection.remove(card);
-        this.items = this.items.filter(function(e) { return e != card });
+        //this.items = this.items.filter(function(e) { return e != card });
+        // dont' really need ot update items.
         card.el.dom.parentNode.removeChild(card.el.dom);
         
+    },
+    reset: function()
+    {
+        this.fileCollection.each(function(card) {
+            card.el.dom.parentNode.removeChild(card.el.dom);    
+        });
+        this.inputEl().dom.value = '[]';
+    },
+    
+    updateInput : function()
+    {
+        var data = [];
+        this.fileCollection.each(function(e) {
+            data.push(e.data);
+        });
+        this.inputEl().dom.value = JSON.stringify(data);
     }