1
我想爲JSON數據使用引導樹。我生成JSON數據是這樣的:如何在引導樹中使用JSON數據?
var newData = [
{
"resName": "LYS",
"atoms": [
{
"atomName": "N",
"x": 37.995,
"y": 20.521,
"z": 9.231
},
{
"atomName": "CA",
"x": 38.067,
"y": 19.342,
"z": 10.141
}
]
}
...
];
在代碼的最後,我希望結果是這樣的:
但http://jonmiles.github.io/bootstrap-treeview碼使用的數據是這樣的:
var defaultData = [
{
text: 'Parent 1',
href: '#parent1',
tags: ['4'],
nodes: [
{
text: 'Child 1',
href: '#child1',
tags: ['2'],
nodes: [
{
text: 'Grandchild 1',
href: '#grandchild1',
tags: ['0']
},
{
text: 'Grandchild 2',
href: '#grandchild2',
tags: ['0']
}
]
},
{
text: 'Child 2',
href: '#child2',
tags: ['0']
}
]
},
{
text: 'Parent 2',
href: '#parent2',
tags: ['0']
}
];
我可以使用resName或原子而不是文本嗎?還是我可以做任何事情來達到我的預期結果?我沒有發現任何關於它的事情。
我明白了。感謝您的回答。 –