Uploader apiOnly error in firefox

edited September 2019 in Technical questions

I'm initializing the uploader using a class constructor in Webix Jet, but I get the error:

TypeError: inputs[(inputs.length - 1)] is undefinedwebix.js:16306:8
    fileDialog webix.js:16306
    showDialog upload.js:93
    addLogoToBioPage bio_windows.js:315

Here is the code:

  config(){

    return {
      view:"uploader",
      name: "uploader",
      apiOnly: true, // f
      upload: 'http://somepath',// f
      autosend: true,
    }
  }
  showDialog(){
    this.getRoot().fileDialog();
  }

Initializing uploader

  let upl = new UploaderModule(this.app, uploadProfileConfig);
  that._uploader = this.ui(upl);
  setTimeout(() => {
    this._uploader.showDialog()
  }, 0);

Any suggestions on this?

Comments

  • edited September 2019

    Hey @twigz, I've tried running a similar code locally, and couldn't reproduce the issue unfortunately. Please take a look at the code below and see if anything seems off to you.

    Here is the view where the uploader API gets imported:

    import {JetView} from "webix-jet";
    import UploaderModule from "./uploader";
    
    export default class TestView extends JetView {
        config() {
            return {
                rows: [
         // here i'm creating a button to call the API, setTimeout() on init() also works
                    {
                        view: "button",
                        value: "Upload",
                        localId: "test",
                        click: () => {
                            this.uploader.showDialog();
                        }
                    }
                ]
            };
        }
    
        init() {
            const config = {
                api: true,
                upload: "http://test"
            };
    
            let upl = new UploaderModule(this.app, config);
    
            this.uploader = this.ui(upl);
        }
    }
    

    And here is the module itself:

    import {JetView} from "webix-jet";
    
    export default class UploaderModule extends JetView {
        constructor(app, config) {
            super(app);
            this._api = config.api;
            this._upload = config.upload;
        }
    
        config() {
            return {
                localId: "test",
                view: "uploader",
                name: "uploader",
                apiOnly: this._api, 
                upload: this._upload, 
                autosend: true
            };
        }
    
        showDialog() {
            this.getRoot().fileDialog();
        }
    }
    

    Judging from the error log, either you have an undefined variable inputs in one of your functions, or you are referring to a non-existant value in that array. Either way, I would need a bit more details to be able to help you out here.

    Also, seeing as you've mentioned Firefox, does this issue also occur in other browsers, or just Firefox (I've tried running the aforementioned code in Chrome and Firefox, both worked fine)?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion