我正在尝试将http://www.dropzonejs.com/文件上传器集成到现有的 ExtJS 3.4 应用程序中。我遇到了问题,因为 ExtJS 创建的元素似乎无法使用document.
DropzoneJS 使用的本机方法获得。
我想在动态创建的 ExtJS 窗口中呈现上传面板:
App.DropzoneWindow = function(config) {
config = config || {};
Ext.applyIf(config, {
url: App.config.connectorUrl
,dropzone: null
,base_params: {}
});
OB.DropzoneWindow.superclass.constructor.call(this, config);
this.dropzone = this.initDropzoneJs();
};
Ext.extend(App.DropzoneWindow, App.Window, {
initDropzoneJs: function() {
var config = {
url: this.url
};
return new Dropzone('div#'+this.id, config);
}
});
Ext.reg('app-dropzone-window', App.DropzoneWindow);
Dropzone.js 立即抛出错误“无效的 dropzone 元素”,因为它试图使用document.querySelector()
. 以下是在源代码中抛出错误的行:
https://github.com/enyo/dropzone/blob/master/downloads/dropzone.js#L636-L640
有什么想法可以在不修改 Dropzone.js 源的情况下实现这一目标吗?