Browse Source

Merge pull request #342 from wangjx9110/master

To support extra field update in filepreupload event handler
Kartik Visweswaran 9 năm trước cách đây
mục cha
commit
d1bd98b78f
2 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 1 0
      .gitignore
  2. 7 2
      js/fileinput.js

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 nuget/content/
 nuget/bootstrap-fileinput.*.nupkg
+.DS_Store

+ 7 - 2
js/fileinput.js

@@ -1243,7 +1243,8 @@
         },
         ajaxSubmit: function (fnBefore, fnSuccess, fnComplete, fnError) {
             var self = this, settings;
-            self.uploadExtra();
+            // to support extra field update in fnBefore function
+            // self.uploadExtra();
             settings = $.extend({
                 xhr: function () {
                     var xhrobj = $.ajaxSettings.xhr();
@@ -1256,7 +1257,11 @@
                 cache: false,
                 processData: false,
                 contentType: false,
-                beforeSend: fnBefore,
+                beforeSend: function() {
+                    // to support extra field update in fnBefore function
+                    fnBefore.apply(this, arguments);
+                    self.uploadExtra();                    
+                },
                 success: fnSuccess,
                 complete: fnComplete,
                 error: fnError