我正在使用 jqtree 插件来生成树视图。现在我想通过标签对每个节点的树进行排序。
该插件没有排序功能,所以我认为我需要在将数据加载到其中之前对其进行排序。
这是我要排序的数据。
[
{
"label": "A label",
"id": "201",
"children": [
{
"label": "C Label",
"id": "40773",
"children": [
{
"label": "F label",
"id": "222460",
"children": []
},
{
"label": "C label",
"id": "222469",
"children": []
},
{
"label": "X label",
"id": "27512",
"children": [
{
"label": "F label",
"id": "143546",
"children": []
},
{
"label": "D label",
"id": "141341",
"children": [
{
"label": "G label",
"id": "222456",
"children": []
},
{
"label": "L label",
"id": "222457",
"children": []
},
{
"label": "x label",
"id": "222443",
"children": [
{
"label": "Z label",
"id": "222447",
"children": []
},
{
"label": "A label",
"id": "222446",
"children": []
}
]
},
{
"label": "L label",
"id": "222455",
"children": []
}
]
},
{
"label": "A label",
"id": "143547",
"children": [
{
"label": "B label",
"id": "222458",
"children": []
}
]
},
{
"label": "R label",
"id": "143548",
"children": []
}
]
}
]
}
]
}
]
非常感谢您的任何建议。