我为 FineUploaderBasic 类创建了一个包装器,以便将它与我现有的系统链接起来,当调用 onComplete 函数时,它在 FineUploaderBasic 元素而不是父元素的范围内被调用。
如何更改此设置或访问 FineUploaderBasic 实例的父级?
我已经使用 ExtJs 作为 Follow's 编写了代码,并且我试图在 FineUploader 上传完成后触发我自己的上传完成事件。但是在 FineUploader 实例的范围内调用了“onUploadComplete”函数,我无法访问我自己的对象。
Ext.define('X4.Core.FileUploader', {
mixins: {
observable: 'Ext.util.Observable'
},
uploader: null,
constructor: function (config) {
this.initConfig(config);
this.mixins.observable.constructor.call(this, config);
this.addEvents({
/**
* Event which is triggered once the file upload has been completed successfully.
*
* @since X4 4.1.1
*/
"uploadcomplete": true
});
return this;
},
getUploader: function () {
var me = this;
if (me.uploader === null) {
me.uploader = new qq.FineUploaderBasic({
autoUpload: false,
request: {
endpoint: '/_system/x4/commands/file_uploader.ashx'
},
callbacks: {
onComplete: me.onUploadComplete
}
});
}
return me.uploader;
},
onUploadComplete: function(id, name, response) {
var me = this;
alert('upload complete ' + id + ' ' + name + ' ' + response);
me.fireEvent('uploadcomplete', me.callbackScope, id, name, response);
},
addFile: function (fileInput) {
var me = this;
return me.getUploader().addFiles(fileInput.extractFileInput());
},
upload: function () {
var me = this;
me.getUploader().uploadStoredFiles();
}
});