Browse Source

Fix #183: Delete extra data enhancements

Kartik Visweswaran 10 years ago
parent
commit
dd9a8de538
4 changed files with 4 additions and 3 deletions
  1. 1 0
      CHANGE.md
  2. 1 1
      README.md
  3. 2 2
      js/fileinput.js
  4. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -11,6 +11,7 @@ version 4.1.8
 7. (enh #178): Updated README for cancel button configuration.
 8. (enh #179): Validate and cast `maxFileSize`, `maxFileCount`, and `initialPreviewCount` to numeric - even if they have been setup as a string.
 9. (enh #181): Fix change event triggered for IE 11 when file input is set to empty.
+10. (enh #183): Delete extra data enhancements.
 
 version 4.1.7
 =============

+ 1 - 1
README.md

@@ -245,7 +245,7 @@ initialPreviewConfig: [
 
 > Note: The ajax delete action will send the following data to server via POST:
 - `key`: the key setting as setup in `initialPreviewConfig['key']`
-- `extra`: the extra data passed either via `initialPreviewConfig['extra']` OR `deleteExtraData` if former is not set.
+- any other extra data as `key: value` pairs passed either via `initialPreviewConfig['extra']` OR `deleteExtraData` format if former is not set.
 
 #### initialPreviewShowDelete
 _bool_, whether the delete button will be displayed for each thumbnail that has been created with `initialPreview`.

+ 2 - 2
js/fileinput.js

@@ -517,7 +517,7 @@
             self.$preview.find('.file-preview-frame').each(function () {
                 var $thumb = $(this), ind = $thumb.attr('data-fileindex'),
                     file = self.filestack[ind];
-                if (ind == -1) {
+                if (ind === -1) {
                     return;
                 }
                 if (file !== undefined) {
@@ -741,7 +741,7 @@
             self.$preview.find('.kv-file-remove').each(function () {
                 var $el = $(this), $frame = $el.closest('.file-preview-frame'), index = $el.data('index'), 
                     config = isEmpty(self.initialPreviewConfig[index]) ? null : self.initialPreviewConfig[index],
-                    extraData = isEmpty(config) || isEmpty(config['extra']) ? deleteExtraData : config['extra'],
+                    extraData = isEmpty(config) || isEmpty(config.extra) ? deleteExtraData : config.extra,
                     vUrl = $el.data('url') || self.deleteUrl, vKey = $el.data('key'), $content;
                 if (typeof extraData === "function") { 
                     extraData = extraData();

File diff suppressed because it is too large
+ 0 - 0
js/fileinput.min.js


Some files were not shown because too many files changed in this diff