我的应用程序中有2个绑定到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);
但是,我在列表中没有看到任何数据。我非常确定sPath是正确的
checks>/items
。因为模型绑定到sap.ui.core
,所以无法使用此sPath。还是我想念其他东西? 最佳答案
我很确定您必须在propertyBinding前面加上模型名称:
var oItemTemplate = new sap.m.ActionListItem({
title : "{checks>title}",
...
});
这应该工作。