0
https://github.com/vakata/jstree에서 Jstree를 사용하면 트리 구조체 succcess를로드했습니다. 이제 어레이 데이터에서 체크 체크 박스를 바인드하고 싶습니다. 기본적으로 하나의 노드가 id
인 경우 배열의 노드가 id
인지 확인합니다. 확인란이 선택되어 있으면 마찬가지입니다. 이jstree에서 동적 데이터를 확인하는 방법은 무엇입니까?
$('#jstree_demo_div').jstree({
'core': {
'data':
[
{ "id": "A1", "parent": "#", "text": "Simple root node" },
{ "id": "A2", "parent": "#", "text": "Root node 2" },
{ "id": "A3", "parent": "A2", "text": "Child 1" },
{ "id": "A4", "parent": "A2", "text": "Child 2" },
{ "id": "A5", "parent": "A1", "text": "Root Child 1" },
{ "id": "A6", "parent": "A1", "text": "Root Child 2" },
{ "id": "A7", "parent": "A5", "text": "Sub 1" },
{ "id": "A8", "parent": "A5", "text": "Sub 2" }
]
},
"plugins": ["checkbox"]
});
$(window).load(function() {
var array_node = ['A3','A4','A8'];
for (var i = 0; i < array_node.length; i++) {
$('#jstree_demo_div').jstree("select_node", array_node[i]);
}
});
이없는 오류가
'ready.jstree' 이벤트가 더 나은 옵션이라고 생각합니다 :'$ ("# jstree_demo_div") .jstree ({...}). on ("ready.jstree", function (e, 데이터) {...})' –