cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUi5 TypeError: I.fFunction.call is not a function

I'm implementing a FileUploader, displayed in a Dialog. Relevant Code:

function onAddExcelData() {
    var that = this;
    if (this.fixedDialog === undefined) {
        this.fixedDialog = new sap.m.Dialog({
            title: "Choose CSV File for Upload",
            beginButton: new sap.m.Button({
                text: "Upload",
                press: function (oEvent) {
                    that.fixedDialog.close();
                }
            }),
            content: [new sap.ui.unified.FileUploader("excelUploader")],
            endButton: new sap.m.Button({
                text: "Cancel",
                press: function () {
                    that.fixedDialog.close();
                }
            })
        })
        this.getView().addDependent(this.fixedDialog);
        this.fixedDialog.attachBeforeClose(this.setDataToJsonFromExcel, this);
    }
    this.fixedDialog.open();
}
}

Whenever I want to click the beginButton or endButton, the console shows the error

<code>UncaughtTypeError: I.fFunction.call isnot a function

I read about this issue and the suggested solution is always, to define a new variable before calling the press function. But even though I added that variable, I still get the error. Does anyone have further ideas?

ericci
Active Contributor
0 Kudos

Could you please format your code? It's barely readable like this 😞

Accepted Solutions (1)

Accepted Solutions (1)

mariusobert
Developer Advocate
Developer Advocate

Hi Sonja,

the problem in your code is that SAPUI5 cannot find the click handler (onAddExcelData) in your controller. I reproduced this issue in this jsfiddle: https://jsfiddle.net/zeLf961k

You can fix the issue by replacing the call to you handler with:

press: [ oController.onAddExcelData , oController],

As seen here https://jsfiddle.net/zeLf961k/2/

Regards,

Marius

Answers (0)