Programmatic Dojox Uploader - ajax upload not working

前端 未结 1 1430
傲寒
傲寒 2021-01-20 11:31

I can\'t find any docs about creating dojox/form/Uploader programmatically. I tried it by myself, but it looks like that plugin registering mechanism is somehow broken.

相关标签:
1条回答
  • 2021-01-20 12:07

    In short; use new dojox.form.Uploader instead of the pulled in variable, otherwise the plugin extending does not apply.

    Reason being, you would see programmer doing following in the addUploaderPlugin:

    dojox.form.UploaderOrg = dojox.form.Uploader;
    var extensions = [dojox.form.UploaderOrg];
    dojox.form.addUploaderPlugin = function(plug){
    
                extensions.push(plug);
                declare("dojox.form.Uploader", extensions, {});
        }
    

    The class that AMD loader returns is and will allways be dojox.form.UploaderOrg and does not know about the extended plugins.

    Change to following:

    var up = new dojox.form.Uploader({
        label: 'Pick files',
        multiple: true,
        url: '/echo/json/'
    }).placeAt(form);
    

    And make sure you have not set djConfig.publishRequireResult = false

    0 讨论(0)
提交回复
热议问题