xtree中隱藏根節點

 改點源碼就行了

WebFXTree.prototype.toString = function() {

    /*
var str = "<div id=/"" + this.id + "/" οndblclick=/"webFXTreeHandler.toggle(this);/" class=/"webfx-tree-item/" οnkeydοwn=/"return webFXTreeHandler.keydown(this, event)/">" +
        "<img id=/"" + this.id + "-icon/" class=/"webfx-tree-icon/" src=/"" + ((webFXTreeHandler.behavior == 'classic' && this.open)?this.openIcon:this.icon) + "/" οnclick=/"webFXTreeHandler.select(this);/">" +
        "<a href=/"" + this.action + "/" id=/"" + this.id + "-anchor/" οnfοcus=/"webFXTreeHandler.focus(this);/" οnblur=/"webFXTreeHandler.blur(this);/"" +
        (this.target ? " target=/"" + this.target + "/"" : "") +
        ">" + this.text + "</a></div>" +
        "<div id=/"" + this.id + "-cont/" class=/"webfx-tree-container/" style=/"display: " + ((this.open)?'block':'none') + ";/">";
        */   
var str = "<div id=/"" + this.id + "/" οndblclick=/"webFXTreeHandler.toggle(this);/" class=/"webfx-tree-item1/" οnkeydοwn=/"return webFXTreeHandler.keydown(this, event)/">"
         +
         "</div>" +
        "<div id=/"" + this.id + "-cont/" class=/"webfx-tree-container/" style=/"display: " + ((this.open)?'block':'none') + ";/">";
    var sb = [];
    for (var i = 0; i < this.childNodes.length; i++) {
        sb[i] = this.childNodes[i].toString(i, this.childNodes.length);
    }
    this.rendered = true;
    return str + sb.join("") + "</div>";
};

將這個div設置成display就行

發佈了24 篇原創文章 · 獲贊 4 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章