jstree的checkbox實例較少,思索后決定進行一下整理,先上代碼
$("#filtrate_row").on("loaded.jstree",function(event, data){
tree_dom = data;
}).on("ready.jstree",function(event, data){
$("#filtrate_row").find("li:first").find("a:first").find("i").remove();
}).jstree({
"core" : {
"multiple" : true,
"animation" : 0,
"themes" : {
"theme" : "default" ,
"dots" : true,
"icons" : false
},
'data' : {
'url' : function () {
return path + 'datadictAction/getAType?type=tzly';
},
'data' : function (node) {
return {"id": node.id};
}
}
},
ui : {
theme_name : "checkbox"
} ,
plugins : ["sort","types","checkbox","themes","html_data"],
"checkbox" : {
"keep_selected_style" : false,
"three_state":false,
"tie_selection":false
},
});
首先需要加載checkbox插件,即在plugins中添加checkbox,以加載checkbox樣式。
此處對checkbox的進行了簡單設置:
①、"keep_selected_style" : false,是否默認選中
②、"three_state":false,是否進行父子節點級聯選擇
主題樣式更改:
"theme" : "default" ,默認樣式 "dots" : true, 是否展示連接線 "icons" : false 是否展示圖標
loaded.jstree,此事件是加載根節點后進行觸發
ready.jstree,此事件是加載所節點后進行觸發
url:請求地址
