EasyUI 的 combotree 加載數據后折疊起來,並且只允許單擊子節點的寫法


  $(source).combotree({
            url: '',
            width: kuan,
            valueField: 'id',
            textField: 'text',
            onlyLeafCheck: true,
            onBeforeSelect: function (node) {
                if (onlyLeaf) {
                    var t = $(this).tree;
                    var isLeaf = t('isLeaf', node.target);
                    if (!isLeaf) {
                        return false;
                    }
                } else {
                    return true;
                }
            },
            onLoadSuccess: function (row, data) {
                $(source).combotree('tree').tree("collapseAll");
            }
        });

自己研究過這個,kuan,是combotree的寬度設置,onlyLeaf表示是否只允許單擊子節點,true,表示只允許單擊子節點

然后還有個功能,就是 加載成功后,折疊起來

 整體方法,我是這樣子的

 function (source, params, kuan, onlyLeaf) {//onlyLeaf 是否只能是子節點單選
        if (kuan == null) kuan = 150;
        $(source).combotree({
            url: '/基本URL?' + params,
            width: kuan,
            valueField: 'id',
            textField: 'text',
            onlyLeafCheck: true,
            onBeforeSelect: function (node) {
                if (onlyLeaf) {
                    var t = $(this).tree;
                    var isLeaf = t('isLeaf', node.target);
                    if (!isLeaf) {
                        return false;
                    }
                } else {
                    return true;
                }
            },
            onLoadSuccess: function (row, data) {
                $(source).combotree('tree').tree("collapseAll");
            }
        });
    }

  


免責聲明!

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



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