gpt4 book ai didi

sapui5 - OPENUI5 : Named Model Aggregate Binding Data is not showing

转载 作者:行者123 更新时间:2023-12-04 22:12:08 26 4
gpt4 key购买 nike

看完Multimodel Support我试图实现它。
使用命名模型时,会发生绑定(bind)但不显示数据。

// Controller

sap.ui.controller("view.apps.Apps", {

onInit : function () {
var oAppsModel = new sap.ui.model.json.JSONModel("model/apps.json");
this.getView().setModel(oAppsModel, "apps");
}
});

//看法
sap.ui.jsview("view.apps.Apps", {

getControllerName: function() {
return "view.apps.Apps";
},

createContent: function(oController) {

var oInboxList = new sap.m.List({
inset: true,
id: "appsList",
headerText: "Apps"
});

oInboxList.bindItems("apps>/items", function(sID, oContext) {
return new sap.m.StandardListItem({
title: '{name}',
description: '{name}'
})
});

var oPage = new sap.m.Page({
title: "Apps",
content: [oInboxList]
});

return oPage;
}
});

//应用程序.json
{
"items": [{
"name": "ABC",
"view": ""
}, {
"name": "DEF",
"view": ""
}]
}

此 View 生成两个空的 ListItem。当我将模型更改为未命名模型并将 BindPath 更新为/items 时,列表会正确填充并显示值。关于我的编码有什么问题的任何想法?我真的很想使用命名模型。

最佳答案

好的,只需重新阅读文档。使用命名模型进行绑定(bind)时,必须在所有绑定(bind)前面加上命名模型的名称。

oInboxList.bindItems("apps>/items", function(sID, oContext) {
return new sap.m.StandardListItem({
title: '{apps>name}',
description: '{apps>name}'
})
});

关于sapui5 - OPENUI5 : Named Model Aggregate Binding Data is not showing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25401151/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com