2
外部ファイルからjstreeオブジェクトにjsonデータを渡したいと思います。私は、スニペットを以下しているが、それはしませ働くん jstreeの外部jsonファイルからデータをロード
<script>
$.jstree.defaults.core.themes.responsive = true;
$('#frmt').jstree({
plugins: ["checkbox", "types"],
"json_data":{
"ajax" : {
"url" : "D:\p\web\nodes.json" // the URL to fetch the data. Use relative url if required
}
},
"types": {
"file": {
"icon": "jstree-file"
}
}
});
</script>
マイnodes.jsonファイル
[
{
"id": "ajson1",
"parent": "#",
"text": "Simple root node"
},
{
"id": "ajson2",
"parent": "#",
"text": "Root node 2"
}, {
"id": "ajson3",
"parent": "ajson2",
"text": "Child 1"
}, {
"id": "ajson4",
"parent": "ajson2",
"text": "Child 2"
}
]
私はJavaScriptでこのデータを手動で挿入すると、それが正常に動作しますが、私は、ノードのパスを割り当てるとき.json外部ファイルは動作しません。