代码之家  ›  专栏  ›  技术社区  ›  sonja

SAPUi5类型错误:I。函数调用不是函数

  •  2
  • sonja  · 技术社区  · 6 年前

    我正在实现一个文件上传程序,显示在一个对话框中。相关代码:

    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 回复  |  直到 6 年前
        1
  •  0
  •   Matthijs Mennens    6 年前

    和这条线有关。我不知道它做了什么,所以我不能进一步评论这个问题。没有它,函数就可以正常工作。你确定功能正常吗 setDataToJsonFromExcel 是否存在于控制器中?

    希望这有帮助。

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