必要なものを簡単に デモhttp://jsfiddle.net/gwxTa/2/ または http://jsfiddle.net/gwxTa/ または動的 - (追加ボタンをクリック) http://jsfiddle.net/VBSJ8/ または http:/ /jsfiddle.net/ak4Ed/
私の古い投稿を参照してください: jsTree が機能しない
動的追加ボタン機能のコード:
$(function() {
$("#tree").jstree({
"json_data": {
"data": [
{
"data": "Hello",
"attr": {
"id": "root.id"
},
"children": [{
"data": "Hello World",
"attr": {
"id": "node_1"
},
"children": []}
]},
]
},
"plugins": ["themes", "json_data", "crrm"]
});
});
$("#tree").jstree("create", $("#node_1"), "inside", {
"data": "child2"
}, function() {
alert("added");
}, true);
スクリプトが含まれていることを願っています:
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css">
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
<script type='text/javascript' src="http://static.jstree.com/v.1.0pre/jquery.jstree.js"></script>
<script type='text/javascript' src="http://static.jstree.com/v.1.0pre/jquery.hotkeys.js"></script>