xtree中隐藏根节点

来源:互联网 发布:数学答题软件 编辑:程序博客网 时间:2024/06/05 13:17

 改点源码就行了

WebFXTree.prototype.toString = function() {

    /*
var str = "<div id=/"" + this.id + "/" ondblclick=/"webFXTreeHandler.toggle(this);/" class=/"webfx-tree-item/" onkeydown=/"return webFXTreeHandler.keydown(this, event)/">" +
        "<img id=/"" + this.id + "-icon/" class=/"webfx-tree-icon/" src=/"" + ((webFXTreeHandler.behavior == 'classic' && this.open)?this.openIcon:this.icon) + "/" onclick=/"webFXTreeHandler.select(this);/">" +
        "<a href=/"" + this.action + "/" id=/"" + this.id + "-anchor/" onfocus=/"webFXTreeHandler.focus(this);/" onblur=/"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 + "/" ondblclick=/"webFXTreeHandler.toggle(this);/" class=/"webfx-tree-item1/" onkeydown=/"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就行