Json-generated Tree defined in js, jsjsontree
The name here is the json arry generated in js. The json tree plug-in defined in js is jquery. ztree.
Var param = {
};
$. Post ("manager_treeList", param, function (data ){
// Loop list
Var setting = {
View :{
DblClickExpand: false,
ShowLine: true,
SelectedMulti: false
},
Data :{
SimpleData :{
Enable: true,
IdKey: "id ",
PIdKey: "pId ",
RootPId :""
}
},
Callback :{
OnClick: zTreeOnClick
}
};
Var arry = [];
// Biaoqian class
Var BiaoQianBean = {
Id :"",
Box_num :"",
Thumb_url :"",
Type: "sys ",
Addtime :""
};
$. Each (data. managerTree, function (I, tmp ){
If (tmp. pid = "0 ")
{
Var BiaoQianBean = {
Id: tmp. id,
PId: tmp. pid,
Name: tmp. pointName,
Open: true
};
}
Else
{
Var BiaoQianBean = {
Id: tmp. id,
PId: tmp. pid,
Name: tmp. pointName
};
}
Arry. push (BiaoQianBean );
});
Var zTreeDemo = $. fn. zTree. init ($ ("# user_tree"), setting, arry );
});