0
我有以下JSON文件。UI5树绑定到JSON
"idocs": [
{
"Docnum": "00063463",
"Mestyp": "MATMAS",
"Status": "53",
"Sndprn": "EXTSYS1",
"Direct": "Inbound",
"Message": "Material 00002342 Created",
"messages": [{
"message": "Material 00002342 Created"
}],
"segments": [{
"segment": "E1MARAM",
"fields": [{
"fieldName": "MATNR"
}]
}]
}
我想将它绑定到树节点。我有下面的代码来“尝试”做到这一点,它没有做任何事情。甚至没有错误。
var oTree = new sap.ui.commons.Tree("tree")
.placeAt("idViewRoot--idViewDetail--toolBar-content");
oTree.bindAggregation("nodes", tgtPath, function(
sId, oContext) {
alert("stuff");
var treePath = oContext.getPath();
var bindTextName = '';
if (treePath.indexOf("fields") !== -1) {
bindTextName = "fieldName";
} else {
bindTextName = "segment";
}
return new sap.ui.commons.TreeNode()
.bindProperty("text", bindTextName);
});
如果有人可以看一看并指向正确的方向,我将不胜感激。
我应该看到一个警报“东西”出现,因为我甚至没有看到。这可能是绑定的问题。
tgtPath的值是/ idocs/0/segments。
马丁