用http://fason.nease.net/samples/treeview/重写一下expand方法 var _expand = TreeNode.prototype.expand; TreeNode.prototype.expand=function(){ this.__expand=_expand; this.__expand(); if (this.parentNode==null) return; for (var i=0; i<this.parentNode.childNodes.length;i++) if (this.parentNode.childNodes[i]!=this) this.parentNode.childNodes[i].collapse();//关闭其它兄弟节点 }
var _expand = TreeNode.prototype.expand;
TreeNode.prototype.expand=function(){
this.__expand=_expand;
this.__expand();
if (this.parentNode==null) return;
for (var i=0; i<this.parentNode.childNodes.length;i++)
if (this.parentNode.childNodes[i]!=this)
this.parentNode.childNodes[i].collapse();//关闭其它兄弟节点
}