如何使用此JSONModel正确绑定项目?

2020-08-26 13:26发布

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

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


 <表id =" productsTable" inset =" false" items =" {路径:'projects>/data/d/results',排序器:{路径:'ProjectName'}}"" 
 {" d":{"结果":[{" __metadata":{" id":""," uri":""," type":""," etag":""},"  ProjectId":" 7790"," PrgId":" 00000000-0000-0000-0000-000000000000"," ProjectType":" MARKETING"," PrjTypeDescr":" Marketing"," ProjectName":" Marketing_3_MM_29032018"," Acquisition"  :""," AcquisitionLong":""," DevUnitName":" ByD_Channel_Marketing"," OffPrdName":"",

在这种情况下,从JSONModel添加项目的正确方法是什么? 无论我尝试指示的路径如何,都不会显示任何项目

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

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


 <表id =" productsTable" inset =" false" items =" {路径:'projects>/data/d/results',排序器:{路径:'ProjectName'}}"" 
 {" d":{"结果":[{" __metadata":{" id":""," uri":""," type":""," etag":""},"  ProjectId":" 7790"," PrgId":" 00000000-0000-0000-0000-000000000000"," ProjectType":" MARKETING"," PrjTypeDescr":" Marketing"," ProjectName":" Marketing_3_MM_29032018"," Acquisition"  :""," AcquisitionLong":""," DevUnitName":" ByD_Channel_Marketing"," OffPrdName":"",

在这种情况下,从JSONModel添加项目的正确方法是什么? 无论我尝试指示的路径如何,都不会显示任何项目

付费偷看设置
发送
2条回答
spaceman01
1楼-- · 2020-08-26 13:59

Artyom,你好

您可以尝试

<表id =" id_table"项目=" {/d/results}""增长"为" true"," gringScrollToLoad"为" true",throwingThreshold =" 100",visibleRowCount =" 500">

<单元格 > <文本text =" {ProjectId}"/> <文本text =" {ProjectType}"/>

您的绑定;

'projects>/data(不需要)
 items =" {路径:/d/results',排序器:{路径:'ProjectName'}}"" 

在控制器中,

var model = new sap.ui.model.json.JSONModel();

model.setData(data);

model.setDefaultBindingMode(" TwoWay");

sap.ui.core.Core()。byId(" PageID")。setModel(model); 还可以使用:(this.setModel(model))

最好的问候

Kaan。

奄奄一息的小鱼
2楼-- · 2020-08-26 14:17

如果" d"是对象,您可以在回叫中看到它作为响应。

 var数据= this.getResponse()["无论您的回叫是什么"]
 this.getView()。setModel(new sap.ui.model.json.JSONModel(data)," projects")

然后在您的XML视图中(如果要使用">"方式)

 

 <列>
     <文本text =" {projects> ProjectId}"/> 
     <文本text =" {projects> ProjectName}"/> 
 
  

一周热门 更多>