SAPUi5 TypeError:I.fFunction.call不是函数

时间:2018-09-12 13:12:59

标签: javascript sapui5 typeerror function-call

我正在实现一个显示在对话框中的FileUploader。相关代码:

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();
}

每当我要单击beginButton或endButton时,控制台都会显示错误

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

我了解了此问题,建议的解决方案始终是在调用press函数之前定义一个新变量。但是,即使我添加了该变量,我仍然会收到错误消息。有人有进一步的想法吗?

1 个答案:

答案 0 :(得分:0)

这与这行有关。我不知道该怎么做,因此无法在此问题上进一步评论。没有这些功能,就可以正常工作。您确定控制器中存在功能setDataToJsonFromExcel吗?

希望这会有所帮助。

this.fixedDialog.attachBeforeClose(this.setDataToJsonFromExcel, this);