UI5中的表绑定

2020-09-17 05:10发布

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

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


你好专家

我正在尝试开发一个应用程序,其中上传了csv,然后将其显示在表格中以供审核。 我可以使用csv上传文件,并且相信我已经正确创建了json,但是无论如何尝试,我都无法使数据显示在表格中。

这是我的控制者:

uploadCSVFile:function(oEvent){var that = this; var file = oEvent.getParameter(" files")[0]; if(file && window.FileReader){var reader = new FileReader(); reader.onload = function(evn){var strCSV = evn.target.result; //CSV中的字符串var jsonCSV = that.csvJSON(strCSV); console.log(jsonCSV); var oModel = new sap.ui.model.json.JSONModel(); //将JSON载入模型oModel.loadData(jsonCSV); sap.ui.getCore()。setModel(oModel); }; reader.readAsText(file); }},

这是我的观点:

<表id =" pirTable"项目=" {uploadData>/}"> <列> <列> <文本text ="材料"> <列> <文本text =" Plant"> <文本text =" {uploadData> mrparea}"> <文本text =" {uploadData> rtype}"> <文本text =" { uploadData> version}"> <文本text =" {uploadData> quantity}"> <文本text =" {uploadData> mrpcont 滚子}">

这是语句的控制台日志输出:

{"材料":" YPIR001","植物":" 1710"," mrparea":" 1710"," rtype":" VSF","版本":" 0","句号":" 612018 ","句点类型":" M"," baseuom":" PC","数量":" 100"," mrpcontroller \ r":" 1 \ r"},{" material":" YPIR001","工厂 ":" 1710"," mrparea":" 1710"," rtype":" VSF"," version":" 0"," period":" 712018"," periodtype":" M"," baseuom": " PC","数量":" 100"," mrpcontroller \ r":" 1"}]

谢谢!

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

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


你好专家

我正在尝试开发一个应用程序,其中上传了csv,然后将其显示在表格中以供审核。 我可以使用csv上传文件,并且相信我已经正确创建了json,但是无论如何尝试,我都无法使数据显示在表格中。

这是我的控制者:

uploadCSVFile:function(oEvent){var that = this; var file = oEvent.getParameter(" files")[0]; if(file && window.FileReader){var reader = new FileReader(); reader.onload = function(evn){var strCSV = evn.target.result; //CSV中的字符串var jsonCSV = that.csvJSON(strCSV); console.log(jsonCSV); var oModel = new sap.ui.model.json.JSONModel(); //将JSON载入模型oModel.loadData(jsonCSV); sap.ui.getCore()。setModel(oModel); }; reader.readAsText(file); }},

这是我的观点:

<表id =" pirTable"项目=" {uploadData>/}"> <列> <列> <文本text ="材料"> <列> <文本text =" Plant"> <文本text =" {uploadData> mrparea}"> <文本text =" {uploadData> rtype}"> <文本text =" { uploadData> version}"> <文本text =" {uploadData> quantity}"> <文本text =" {uploadData> mrpcont 滚子}">

这是语句的控制台日志输出:

{"材料":" YPIR001","植物":" 1710"," mrparea":" 1710"," rtype":" VSF","版本":" 0","句号":" 612018 ","句点类型":" M"," baseuom":" PC","数量":" 100"," mrpcontroller \ r":" 1 \ r"},{" material":" YPIR001","工厂 ":" 1710"," mrparea":" 1710"," rtype":" VSF"," version":" 0"," period":" 712018"," periodtype":" M"," baseuom": " PC","数量":" 100"," mrpcontroller \ r":" 1"}]

谢谢!

付费偷看设置
发送
4条回答
SC_Yao
1楼-- · 2020-09-17 05:21

sap.ui.getCore()。setModel(oModel," uploadData")

Violet凡
2楼-- · 2020-09-17 05:24

如果您能够将json写入控制台,那么看起来您的json模型是 未命名的模型。

从items属性中删除{uploadData>/}以绑定到未命名的模型-> items中。


然后为您的文本列..做类似

的操作

<文本text =" {plant}"/>

etc

compass1988
3楼-- · 2020-09-17 05:14

sap.ui.getCore(pirTable).setModel(oModel),请尝试一下是否可行

微wx笑
4楼-- · 2020-09-17 05:13

谢谢你们的帮助。 不幸的是,这些选项都不适合我。

一周热门 更多>