//1:flex tree 默认选择树节点 
var modouleName:String;//节点主键
private function GetSelectedItem():void
{

	for(var i:int = 0;i<treList.dataProvider.length;i++)
	{
		var xml:XML = (treList.dataProvider as XMLListCollection).getItemAt(i) as XML
		var xmlIst:XMLList= xml.children();
		if(treList.dataProvider[i].@Node == modouleName)
		{
			treList.selectedIndex = i;
			break;
		} 
		if(xmlIst.length()>0)
		{
			validateNow();
			treList.expandChildrenOf(xml,true);
			getSe(xmlIst);
			if(isSelect)
				break;
			
		}
		
	}
}
private function getSe(xml:XMLList):void
{
	for(var i :int=0;i<xml.length();i++)
	{
		if(xml[i].@Node==modouleName)
		{
			treList.selectedItem=xml[i];
			isSelect=true;
			break;
		}
		else
		{
			isSelect=false;
		}
	}
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-14
  • 2021-09-15
  • 2022-02-08
  • 2022-12-23
猜你喜欢
  • 2021-04-10
  • 2021-09-24
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
  • 2022-01-07
相关资源
相似解决方案