控制結構樹復選框選中的個數
$('.jstree_all').jstree({ //結構樹給出的方法
'core': { //核心
'check_callback': true
},
'plugins': ['types', 'dnd', "checkbox"],
'checkbox': {
'keep_selected_style': true, //是否默認選中
'three_state': true, //父子級別級聯選擇
'tie_selection': true
},
'types': {
'default': {
'icon': 'fa fa-folder'
}
}
}).on('loaded.jstree', function(e, data) { //默認全選 給出的方法
var inst = $('#jstree_gly').jstree(true); //用inst代替id為 jstree_gly的結構樹
var obj1 = inst.get_node(e.target.firstChild.firstChild); //用obj1代替找到下層的結構點
// console.log(e.target.firstChild.firstChild);
var obj2 = inst.get_node(e.target.firstChild.lastChild); //同上
inst.select_node(obj1); //執行選中obj1
inst.select_node(obj2); //執行選中obj2
});