easyui combotree不讓父級選中


easyui combotree不讓父級選中?

<ul id="combotree"></ul>
 $(function () {
        $("#combotree").combotree({
            width: 300,
            data: [{
                "id": 1,
                "text": "My Documents",
                "children": [{
                    "id": 11,
                    "text": "Photos",
                    "state": "closed",
                    "children": [{
                        "id": 111,
                        "text": "Friend"
                    }, {
                        "id": 112,
                        "text": "Wife"
                    }, {
                        "id": 113,
                        "text": "Company"
                    }]
                }, {
                    "id": 12,
                    "text": "Program Files",
                    "children": [{
                        "id": 121,
                        "text": "Intel"
                    }, {
                        "id": 122,
                        "text": "Java",
                        "attributes": {
                            "p1": "Custom Attribute1",
                            "p2": "Custom Attribute2"
                        }
                    }, {
                        "id": 123,
                        "text": "Microsoft Office"
                    }, {
                        "id": 124,
                        "text": "Games",
                        "checked": true
                    }]
                }, {
                    "id": 13,
                    "text": "index.html"
                }, {
                    "id": 14,
                    "text": "about.html"
                }, {
                    "id": 15,
                    "text": "welcome.html"
                }]
            }]
            ,
            method: 'get',
            ines: true,
            multiple: true,
            onBeforeCheck: function (node) {
                //alert($("#combotree").combotree("tree").tree('isLeaf', node.target));
                if (!$("#combotree").combotree("tree").tree('isLeaf', node.target)) {
                    return false;
                }
            }
        })
    })

關鍵代碼:

onBeforeCheck: function (node) {
                //alert($("#combotree").combotree("tree").tree('isLeaf', node.target));
                if (!$("#combotree").combotree("tree").tree('isLeaf', node.target)) {
                    return false;
                }
            }

 

技術交流QQ群:15129679


免責聲明!

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



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