Last active
August 30, 2016 14:18
-
-
Save csim/4513ae3316104e6f474d to your computer and use it in GitHub Desktop.
Dropzone Knockout binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.bindingHandlers.dropzone = { | |
init: function(element, valueAccessor) | |
{ | |
var value = ko.unwrap(valueAccessor()); | |
var options = { | |
maxFileSize: 15, | |
createImageThumbnails: false, | |
}; | |
$.extend(options, value); | |
$(element).addClass('dropzone'); | |
new Dropzone(element, options); // jshint ignore:line | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-bind="dropzone: { url: '/upload', success: attachmentSuccess }"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi I am adding existing images to dropzone. my custom binding code is:
I am fetching existing images data through ajax but the above code is executed before ajax response is received and existing images are not shown. How can I handle this?