Reputation: 13
I disabled upload widget using the following script but I can still use drag and drop functionality to upload files. Is this a bug or Am i doing something wrong?
<script type="text/javascript">
$(document).ready(function () {
$("#files").kendoUpload({
multiple: false,
async: {
saveUrl: save,
autoUpload: true
},
enabled: false
});
});
</script>
Upvotes: 1
Views: 1975
Reputation: 18402
I'd call that a bug - here's how you can fix it until Telerik does (demo):
kendo.ui.Upload.fn.toggle = function(enable) {
var that = this;
enable = typeof(enable) === "undefined" ? false : enable;
this.wrapper.toggleClass("k-state-disabled", !enable);
this.element.prop("disabled", !enable);
var dragZone = $(".k-dropzone", that.wrapper);
if (enable) {
if (!dragZone.length) {
this._setupDropZone();
} else {
dragZone.on("drop" + that._ns, $.proxy(this._onDrop, this));
}
} else {
dragZone.off("drop" + that._ns);
}
};
kendo.ui.Upload.fn._supportsDrop = function() {
var userAgent = this._userAgent().toLowerCase(),
isChrome = /chrome/.test(userAgent),
isSafari = !isChrome && /safari/.test(userAgent),
isWindowsSafari = isSafari && /windows/.test(userAgent);
return !isWindowsSafari && this._supportsFormData() && (this.options.async.saveUrl) && (this.options.enabled);
}
(add this before you first create your widget)
Upvotes: 1