try and get ctrl-enter to add a clear all
[roojs1] / Roo / bootstrap / ButtonUploader.js
index 506d12d..cd62d87 100644 (file)
@@ -12,7 +12,7 @@
  * @cfg {Number} errorTimeout default 3000
  * @cfg {Array}  images  an array of ?? Img objects ??? when loading existing files..
  * @cfg {Array}  html The button text.
-
+ * @cfg {Boolean}  multiple (default true) Should the upload allow multiple files to be uploaded.
  *
  * @constructor
  * Create a new CardUploader
@@ -56,23 +56,16 @@ Roo.extend(Roo.bootstrap.ButtonUploader, Roo.bootstrap.Button,  {
     fileCollection : false,
     allowBlank : true,
     
+    multiple : true,
+    
     getAutoCreate : function()
     {
-        
+       
         
         return  {
             cls :'div' ,
             cn : [
-                Roo.bootstrap.Button.prototype.getAutoCreate.call(this),
-                {
-                    tag: 'input',
-                    multiple : 'multiple',
-                    type : 'file',
-                    cls : 'd-none  roo-card-upload-selector' 
-                  
-                }
-                 
-
+                Roo.bootstrap.Button.prototype.getAutoCreate.call(this) 
             ]
         };
            
@@ -93,10 +86,18 @@ Roo.extend(Roo.bootstrap.ButtonUploader, Roo.bootstrap.Button,  {
                                 (window.URL && URL.revokeObjectURL && URL) || 
                                 (window.webkitURL && webkitURL);
                         
-         
-         
-         
-        this.selectorEl = this.el.select('.roo-card-upload-selector', true).first();
+        var im = {
+            tag: 'input',
+            type : 'file',
+            cls : 'd-none  roo-card-upload-selector' 
+          
+        };
+        if (this.multiple) {
+            im.multiple = 'multiple';
+        }
+        this.selectorEl = Roo.get(document.body).createChild(im); // so it does not capture click event for navitem.
+       
+        //this.selectorEl = this.el.select('.roo-card-upload-selector', true).first();
         
         this.selectorEl.on('change', this.onFileSelected, this);
          
@@ -125,7 +126,7 @@ Roo.extend(Roo.bootstrap.ButtonUploader, Roo.bootstrap.Button,  {
             return;
         }
         var files = Array.prototype.slice.call(this.selectorEl.dom.files);
-        this.selectorEl.dom.reset();
+        this.selectorEl.dom.value  = '';// hopefully reset..
         
         this.fireEvent('uploaded', this,  files );