Flex Tree all expand by default Select any one of the node processing

Source: Internet
Author: User

1. XML Original format

<fx:xmllist id= "Menuxml" >
   <Root>
	<node sid= "029"
	      sname= "Six Huan Qu Toll station"
	      mydata= "GLOBAL" >
	  <node sid= "029710000"
	        sname= "inner ring Exit"
		pid= "029"
		mydata= "Exit" >
	   <node sid= "01002"
		 sname= "Outside First Lane"
		 Pid= "029710000"
		 sflag= "0"
		 mydata= "LANE"/>
	   </NODE>
	</NODE>
 </root >
</fx:XMLList>
2, select a node, this node through @mydata already know is that type

                                var xmlstring:string=menuxml;
				if (xmlstring! = "<Root/>")
				{
					this.xml=new xml (xmlstring);
					Loop the data of the last layer of nodes, which is the node data that should be selected, which can be set according to the hierarchy of the node for every
					(Var treeitem:xml in Xml.children (). Children (). Children ( )
					{
						//If it is a parking unit, select and obtain the relevant information
						if (treeItem. @MYDATA = = "LANE")
						{
							Tree_id.selecteditem=treeitem ;
							Break;}}}

				

3. Expand All

			        if (!tree_id.isitemopen (XML (This.xml.NODE)))
				{
					This.tree_id.expandItem (XML (This.xml.NODE), true, true);
				}
				//Expand first-level node
				//	This.tree_id.expandItem (XML (this.xml. NODE. (@MYDATA = = "GLOBAL"), true, true);
				Expand all nodes
				for every (Var item:object in Tree_id.dataprovider)
				{
					tree_id.expandchildrenof (item, True);
				}
4. Perform other methods after selecting the node

			      Gets the default selected node information
				tree_id.calllater (function (): void
					{
						if (tree_id.selecteditem! = null)
						{
							Parknamestr=global_tree.selecteditem. @SNAME;
							Parkidstr=global_tree.selecteditem. @SID;
							Parkcostobj.findcostlist (PARKIDSTR); Execution method
						}
					});


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.