ITeye博客

tree 打开节点

demojava · 2011-12-19 22:40 · Adobe · Web前端 · Markdown

//starts at the given node, walks up the tree opening nodes as it goes
private function expandParents(xmlNode:XML):void
{
	while (xmlNode.parent() != null) {  
	xmlNode = xmlNode.parent();
	myTree.expandItem(xmlNode,true, false);
}
}//expandParents

//uses e4x to find a node, then calls expand parents to make it visible,
//then selects it      
private function findNodeById(sId:String):void
{
	var xmllistDescendants:XMLList  = _xmlData.descendants().(@eid == sId);
	//如果是模糊搜索可以用下面的代码
	//var xmllistDescendants:XMLList  = treeXml.descendants().(@name.toString().indexOf(nameStr)>-1);
	expandParents(xmllistDescendants[0]);
	myTree.selectedItem = xmllistDescendants[0];
}//findNodeById 

 转载连接:http://yunzhongxia.iteye.com/blog/1258409

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。