我尝试使用sapui5的网络图控件构建树状结构。 注释和线条的可视化没有问题。但是我的问题来自节点的顺序。
我用JSONModel中的数据构建我的树。 .json看起来像这样:
{
"nodes": [{
"key": 10000,
"title": "TOP",
"shape": "Box",
"status": "Error",
"description": "",
"attributes": [{
"label": "Position Number",
"value": "10000"
}]
}, {
"key": 1000,
"title": "A",
"shape": "Box",
"status": "Success",
"attributes": [{
"label": "Position Number",
"value": "1000"
}]
}, {
"key": 2000,
"title": "B",
"shape": "Box",
"status": "Success",
"attributes": [{
"label": "Position Number",
"value": "2000"
}]
}, {
"key": 3000,
"title": "C",
"shape": "Box",
"status": "Success",
"attributes": [{
"label": "Position Number",
"value": "3000"
}]
}, {
"key": 4000,
"title": "D",
"shape": "Box",
"status": "Success",
"attributes": [{
"label": "Position Number",
"value": "4000"
}]
}, {
"key": 5000,
"title": "E",
"shape": "Box",
"status": "Success",
"attributes": [{
"label": "Position Number",
"value": "5000"
}]
}, {
"key": 6000,
"title": "F",
"shape": "Box",
"status": "Success",
"attributes": [{
"label": "Position Number",
"value": "6000"
}]
}, {
"key": 7000,
"title": "G",
"shape": "Box",
"status": "Success",
"attributes": [{
"label": "Position Number",
"value": "7000"
}]
}, {
"key": 8000,
"title": "H",
"shape": "Box",
"status": "Success",
"attributes": [{
"label": "Position Number",
"value": "8000"
}]
}, {
"key": 9000,
"title": "I",
"shape": "Box",
"status": "Success",
"attributes": [{
"label": "Position Number",
"value": "9000"
}]
}],
"lines": [{
"from": 10000,
"to": 1000
}, {
"from": 10000,
"to": 2000
}, {
"from": 10000,
"to": 3000
}, {
"from": 10000,
"to": 4000
}, {
"from": 10000,
"to": 5000
}, {
"from": 10000,
"to": 6000
}, {
"from": 10000,
"to": 7000
}, {
"from": 10000,
"to": 8000
}, {
"from": 10000,
"to": 9000
}]
}
如您所见,显示的树应如下所示:
但是如果我运行该应用程序,则订单如下所示:
我不明白,如何下达订单。
有人可以解释为什么这是我的正确订单的原因吗?