Flex tree 포지셔닝

1. 데이터 소스는 Object
 
// tree 
private function treeLocateNe(treeSource:TreeNode , searchNeName:String):void
{
	if(treeSource.name == searchNeName)
		sourcesTree.selectedItem = treeSource;
	else if(treeSource.children != null)
	{
		sourcesTree.expandChildrenOf(treeSource , true);
		for(var i:int = 0 ; i < treeSource.children.length ; i++)
		{
			treeLocateNe(treeSource.children[i] , searchNeName);
		}
	}
} 

 
 
 
2. 데이터 소스는 XML
// tree 
private function treeLocateNe(treeSource:XMLList , searchNeName:String):void
{				
	for(var i:int=0;i<treeSource.length();i++)
	{
		var childXml:XML =treeSource[i];
		var guid:String = childXml.@labels ;
		if(guid != null && guid == searchNeName)
		{
			// 
			for each(var item:XML in sourcesTree.dataProvider)
			sourcesTree.expandChildrenOf(item,true);
			
			sourcesTree.selectedItem = childXml;    //tree 
			return;
		}else if(sourcesTree.dataDescriptor.isBranch(childXml))// , 
		{
			treeLocateNe(childXml.children(),searchNeName);
		}
		
	}
} 

좋은 웹페이지 즐겨찾기