我对多模型绑定有问题。
在控制器的init函数中,我在ui.core中设置了JSON模型
var oModel = new sap.ui.model.json.JSONModel(data1);
sap.ui.getCore().setModel(oModel, "model1");在视图中,我有一个ColumnListItem模板,并将其绑定到一个表中
var template = new sap.m.ColumnListItem({
id: "first_template",
type: "Navigation",
type : sap.m.ListType.Active,
visible: true,
selected: true,
cells: [ new sap.m.Label({
text: "{name}"
})
],
press: [oController.pressListMethod]
});
oTable.bindItems("model1>/events", template, null, null);
oPage.addContent(oTable);对于simple model,它的工作非常严格,但是在多模型表中,它只得到项目的数量,而不是模型的属性。有解决办法吗?
发布于 2014-11-27 09:46:13
您还需要在模板中使用模型名:
var template = new sap.m.ColumnListItem({
id: "first_template",
type: "Navigation",
type : sap.m.ListType.Active,
visible: true,
selected: true,
cells: [
new sap.m.Label({
text: "{model1>name}" // No leading "/" here since the binding is relative to the aggregation binding below
})
],
press: oController.pressListMethod
});
oTable.bindItems("model1>/events", template);
oPage.addContent(oTable);https://stackoverflow.com/questions/27166691
复制相似问题