結構樹中復選框選中


控制結構樹復選框選中的個數

 

$('.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

});


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM