瀏覽代碼

Upgrade to v1.6.0

Kartik Visweswaran 11 年之前
父節點
當前提交
be8c5cb1f0
共有 2 個文件被更改,包括 10 次插入9 次删除
  1. 10 9
      js/fileinput.js
  2. 0 0
      js/fileinput.min.js

+ 10 - 9
js/fileinput.js

@@ -77,7 +77,6 @@
     };
     var FileInput = function (element, options) {
         this.$element = $(element);
-        this.options = options;
         this.init(options);
         this.listen();
     };
@@ -127,7 +126,7 @@
                 self.$container = self.createContainer();
             }
             else {
-                self.$container.html(self.renderMain());
+                self.refreshContainer();
             }
             /* Initialize plugin option parameters */
             self.$captionContainer = getElement(options, 'elCaptionContainer', self.$container.find('.file-caption'));
@@ -147,6 +146,7 @@
                 caption: self.$caption.html(),
                 hiddenVal: self.$hidden.val()
             };
+            this.options = options;
         },
         listen: function () {
             var self = this;
@@ -155,13 +155,8 @@
             self.$container.find('.fileinput-remove').on('click', $.proxy(self.clear, self));
         },
         refresh: function (options) {
-            var self = this;
-            if (arguments.length) {
-                self.init($.extend(self.options, options));
-            }
-            else {
-                self.init(self.options);
-            }
+            var self = this, params = (arguments.length) ? $.extend(self.options, options) : self.options;
+            self.init(params);
         },
         initPreview: function () {
             var self = this, html = '',
@@ -300,6 +295,12 @@
             container.find('.btn-file').append(self.$element);
             return container;
         },
+        refreshContainer: function () {
+            var self = this;
+            self.$container.before(self.$element);
+            self.$container.html(self.renderMain());
+            self.$container.find('.btn-file').append(self.$element);
+        },
         renderMain: function () {
             var self = this;
             var preview = self.previewTemplate.replace('{class}', self.previewClass);

文件差異過大導致無法顯示
+ 0 - 0
js/fileinput.min.js


部分文件因文件數量過多而無法顯示