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。
馬丁