jquery.highCheckTree:如何使用嵌套的父子关系JSON

时间:2017-09-30 05:01:45

标签: javascript jquery

您好我需要使用嵌套数据创建树视图显示..但无法显示..

来源演示网址:http://www.jqueryscript.net/demo/jQuery-Plugin-To-Create-Checkbox-Tree-View-highchecktree/



         var mockData= [{
    item:{id:'id', label:'label', checked:false}, 
    chidren:[{
        item:{id:'id2', label:'label2', checked:false}, 
        chidren:[
          {item:{id:'id3', label:'label3', checked:false}
            
          }]
    }]
},
{
    item:{id:'id11', label:'label11', checked:false}, 
    chidren:[{
        item:{id:'id211', label:'label211', checked:false}, 
        chidren:[
          {item:{id:'id311', label:'label311', checked:false}
            
          }]
    }]
}];

            
            $('#tree-container').highCheckTree({
                data: mockData
            });
   

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="http://www.jqueryscript.net/demo/jQuery-Plugin-To-Create-Checkbox-Tree-View-highchecktree/css/highCheckTree.css" rel="stylesheet"/>
<script src="http://www.jqueryscript.net/demo/jQuery-Plugin-To-Create-Checkbox-Tree-View-highchecktree/js/highchecktree.js"></script>
     <div id="tree-container"></div>
   
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

只是您错过了'l'中的children。在所有这些中。否则它完全没问题。

chidren:[ - &gt; children:[