我的应用程序中有两个绑定到sap.ui.core的模型。下面的代码来自我的主视图。这是一个拆分应用程序。
var checks = {
items: [
{
checklist: "ContainerCheck",
title:"Scan RFID container",
}
// etc...
]}
;
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(checks);
sap.ui.getCore().setModel(oModel, "checks");
在另一个视图中,我希望将数据绑定到母版页
var oItemTemplate = new sap.m.ActionListItem({
title : "{title}",
icon : "sap-icon://activity-2",
activeIcon: "sap-icon://activity-2",
type : sap.m.ListType.Active,
});
this.oList = new sap.m.List({
itemPress: [oController.onListSelect, oController]
});
this.oList.bindItems("checks>/items",oItemTemplate);
但是,我在列表中看不到任何数据。我非常确定checks>/items
的sPath是正确的。因为模型绑定到sap.ui.core
,所以不能使用此sPath。或者我还漏掉了什么?
发布于 2014-07-15 18:56:58
我非常确定您必须在propertyBinding前面加上型号名称:
var oItemTemplate = new sap.m.ActionListItem({
title : "{checks>title}",
...
});
这应该是可行的。
发布于 2014-07-15 18:41:14
尝试使用此this.oList.bindItems("{checks>/items}", oItemTemplete);
而不是this.oList.bindItems("checks>/items",oItemTemplate);
发布于 2015-06-09 21:56:49
我遇到了同样的问题,过了一段时间我发现了this comment
控件只能绑定到一个模型,因此如果您的容器控件具有指定的模型,则此容器中包含的所有控件只能看到容器的本地模型,并且不能再绑定到全局模型。
我认为这就是您代码中的问题所在。至少这是我的那个:-)
https://stackoverflow.com/questions/24740529
复制相似问题