EasyUI Forum
September 16, 2025, 11:48:25 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: tree create infinite child element  (Read 8237 times)
Aod47
Jr. Member
**
Posts: 85


View Profile
« on: July 24, 2015, 11:03:49 PM »

Tree create infinite child element. Shocked

Please see the attach file

I applied code from demo.

May be something wrong in json file.

Could you please advice?

Thank you.

Code:
<body>
    <h2>CheckBox Tree</h2>
    <p>Tree nodes with check boxes.</p>
    <div style="margin:20px 0;">
        <a href="#" class="easyui-linkbutton" onclick="getChecked()">GetChecked</a>
    </div>
    <div style="margin:10px 0">
        <input type="checkbox" checked onchange="$('#tt').tree({cascadeCheck:$(this).is(':checked')})">CascadeCheck
        <input type="checkbox" onchange="$('#tt').tree({onlyLeafCheck:$(this).is(':checked')})">OnlyLeafCheck
    </div>
    <div class="easyui-panel" style="padding:5px">
        <ul id="tt" class="easyui-tree" data-options="url:'treedata3.json',method:'get',animate:true,checkbox:true"></ul>
    </div>
    <script type="text/javascript">
        function getChecked(){
            var nodes = $('#tt').tree('getChecked',['checked','indeterminate']);
console.log(nodes);
            var s = '';
            for(var i=0; i<nodes.length; i++){
                if (s != '') s += ',';
                s += nodes[i].id;
            }
            alert(s);
        }
    </script>
</body>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 25, 2015, 12:16:09 AM »

You can not set the leaf node with 'closed' state. Please correct your json data and try again.
Code:
[
 {"id":100,"text":"Configuration","iconCls":"icon-save","state":"closed","children":[
{"id":110,"text":"User Control","iconCls":"icon-save"},
{"id":120,"text":"System Setting","iconCls":"icon-save"},
{"id":130,"text":"Module Setting","iconCls":"icon-save"}]
 },
...
Logged
Aod47
Jr. Member
**
Posts: 85


View Profile
« Reply #2 on: July 25, 2015, 06:35:50 AM »

It's work now. Thank you very much.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!