显示基于特定JSON数据的SAPUI5表

2020-08-20 19:34发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)这是我的street.json文...

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

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


这是我的street.json文件

{"街道":[

{" id":" 1"," id_region":" 1"," name":" AAA"},

{" id":" 2"," id_region":" 1","名称":" BBB"},

{" id":" 3"," id_region":" 1"," name":" CCC"},

{" id":" 4"," id_region":" 2"," name":" DDD"},

{" id":" 5"," id_region":" 2"," name":" EEE"},

{" id":" 6"," id_region":" 2"," name":" FFF"},]}

基本上,我正在通过控制器中的BindingContext将id_region从region.view.xml发送到street.view.xml。

当我在street.controller.js中捕获到该id_region时,接下来该怎么做才能显示基于id_region的规格列表。

下一个是我在street.controller.js中所做的事情

onInit:函数(){

var oModel = this.getOwnerComponent()。getModel(" streets"); sap.ui.core.UIComponent.getRouterFor(this).getRoute(" StreetsList")。attachPatternMatched(this._onPostMatched,this);

this.oView = this.getView();

this.oRouter = this.getOwnerComponent()。getRouter();

},

_onPostMatched:函数(oEvent){

var oData = this.getOwnerComponent()。getModel(" street");

var oArrey = oData.getProperty("/img/Streets");

var number = oEvent.getParameter(" arguments")。regionId;

for(var i = 0; i

如果(oArrey [i] .id_region ===数字){

var found = i;

休息;

}

}

this.getView()。bindElement({path:"/img/Streets/" + found}); }

1条回答
当学会了学习
2020-08-20 20:08

您好,尼古拉

您可以按街道在街景视图中绑定列表,然后在获得地区ID后,将按地区ID过滤设置为绑定项。

 List.getBinding(" items")。filter(filters); 

一周热门 更多>