绑定分析表时出错

2020-09-06 03:16发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


绑定分析表时遇到错误。 控制台报告"未捕获的TypeError:B.attachContextChange不是函数"。 这是控件的错误吗?

这是我的代码:


//创建DataTable控件
           var oTable = new sap.ui.table.AnalyticalTable({
            宽度:"自动",
            可见:真
         });
        
          
          //定义表格列
           var oControl = new sap.ui.commons.TextView({text:" {lastName}"}); //简短的绑定符号
           oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" Last Name"}}),模板:oControl,sortProperty:" lastName",filterProperty:" lastName"  ,宽度:" 100px"}));
           oControl = new sap.ui.commons.TextField()。bindProperty(" value"," name"); //更详细的绑定符号
           oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" First name"})),模板:oControl,sortProperty:" name",filterProperty:" name"  ,宽度:" 80px"}));
           oControl = new sap.ui.commons.CheckBox({checked:" {checked}"});;
           oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" Checked"}}),模板:oControl,sortProperty:" checked",filterProperty:" checked", 宽度:" 75px",hAlign:"居中"}));
           oControl = new sap.ui.commons.Link({text:" {linkText}",href:" {href}"}));
           oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" Website"}}),模板:oControl,sortProperty:" linkText",filterProperty:" linkText"  }));
          //oControl = new sap.ui.commons.RatingIndicator({value:" {rating}"});
           oControl = new sap.ui.commons.TextField()。bindProperty(" value"," rating");
         var measure = oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" Rating"}}),模板:oControl,sortProperty:" rating",filterProperty:" 评分"}));
      
          
          
          //创建一些本地数据
           var aData = [
                {lastName:" Dente",名称:" Al",已选中:true,linkText:" www.sap.com",href:" http://www.sap.com",等级:4},
                {lastName:" Friese",名称:" Andy",已选中:true,linkText:" https://experience.sap.com/fiori",href:" https://experience.sap.com/fiori",评分 :2},
                {lastName:" Mann",名称:" Anita",已选中:false,linkText:" http://www.saphana.com/",href:" http://www.saphana.com/",评分:3  }
           ];

           console.log(oTable);
          
          //创建一个JSONModel,填写数据并将Table绑定到该模型
           var oModel = new sap.ui.model.json.JSONModel();
           oModel.setData({modelData:aData});
           oTable.setModel(oModel);
           oTable.bindRows("/img/modelData");

           console.log(oTable);
          
          //最后将表格放入用户界面
           oTable.placeAt(" content");
 

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


绑定分析表时遇到错误。 控制台报告"未捕获的TypeError:B.attachContextChange不是函数"。 这是控件的错误吗?

这是我的代码:


//创建DataTable控件
           var oTable = new sap.ui.table.AnalyticalTable({
            宽度:"自动",
            可见:真
         });
        
          
          //定义表格列
           var oControl = new sap.ui.commons.TextView({text:" {lastName}"}); //简短的绑定符号
           oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" Last Name"}}),模板:oControl,sortProperty:" lastName",filterProperty:" lastName"  ,宽度:" 100px"}));
           oControl = new sap.ui.commons.TextField()。bindProperty(" value"," name"); //更详细的绑定符号
           oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" First name"})),模板:oControl,sortProperty:" name",filterProperty:" name"  ,宽度:" 80px"}));
           oControl = new sap.ui.commons.CheckBox({checked:" {checked}"});;
           oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" Checked"}}),模板:oControl,sortProperty:" checked",filterProperty:" checked", 宽度:" 75px",hAlign:"居中"}));
           oControl = new sap.ui.commons.Link({text:" {linkText}",href:" {href}"}));
           oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" Website"}}),模板:oControl,sortProperty:" linkText",filterProperty:" linkText"  }));
          //oControl = new sap.ui.commons.RatingIndicator({value:" {rating}"});
           oControl = new sap.ui.commons.TextField()。bindProperty(" value"," rating");
         var measure = oTable.addColumn(new sap.ui.table.AnalyticalColumn({label:new sap.ui.commons.Label({text:" Rating"}}),模板:oControl,sortProperty:" rating",filterProperty:" 评分"}));
      
          
          
          //创建一些本地数据
           var aData = [
                {lastName:" Dente",名称:" Al",已选中:true,linkText:" www.sap.com",href:" http://www.sap.com",等级:4},
                {lastName:" Friese",名称:" Andy",已选中:true,linkText:" https://experience.sap.com/fiori",href:" https://experience.sap.com/fiori",评分 :2},
                {lastName:" Mann",名称:" Anita",已选中:false,linkText:" http://www.saphana.com/",href:" http://www.saphana.com/",评分:3  }
           ];

           console.log(oTable);
          
          //创建一个JSONModel,填写数据并将Table绑定到该模型
           var oModel = new sap.ui.model.json.JSONModel();
           oModel.setData({modelData:aData});
           oTable.setModel(oModel);
           oTable.bindRows("/img/modelData");

           console.log(oTable);
          
          //最后将表格放入用户界面
           oTable.placeAt(" content");
 
付费偷看设置
发送
3条回答
葫芦娃快救爷爷
1楼 · 2020-09-06 03:35.采纳回答

在此主题中查看罗宾答案

zhangjiyang1323
2楼-- · 2020-09-06 03:46

@Santhosh Gowda

JSONModel不适用于分析表。

非常感谢!

此致

Yang

clasier
3楼-- · 2020-09-06 03:31

尝试使用odata模型。 它仍然没有显示任何数据。 您解决了吗?

一周热门 更多>