Hi , I am creating a hierarchy structure in flex using Flex tree control . The data that I am displaying is being fetched from the Salesforce.com database.
I have an actionscript class , which has the query to fetch records in its constructor itself. And I am creating objects of the class recursively from inside the constructor. The problem here is if the hierarchy has a data of around 15-20k. I tested it with around 5k records, the root node comes up pretty fast, but the nested nodes are taking a lot of time to populate. So, it takes around 5 mins to completely load all the records. Any work around to get the tree loaded faster will be helpful. package hmt { import com.salesforce.Connection; public class TreeNode { import mx.utils.StringUtil; import mx.collections.ArrayCollection; import mx.controls.listClasses.ListData; import mx.controls.treeClasses.TreeListData; import mx.controls.Alert; import com.salesforce.results.QueryResult; import com.salesforce.results.LoginResult; import com.salesforce.objects.SObject; import mx.utils.ObjectUtil; import com.salesforce.AsyncResponder; import com.salesforce.objects.LoginRequest; <salesforce:Connection id="forcetest" serverUrl=" https://test.salesforce.com/services/Soap/u/16.0"> </salesforce:Connection> public function TreeNode(Id :String,name:String,force:Connection) { id = Id; // Set the ID Name = name; // Set the Name //Alert.show("Name="+Name); //children=new ArrayCollection(); //dependent=dep; force.query("SELECT Id,ACCT_HIER__c,INTL_SE_NO__c,ACCT_STATUS__c,Industry,Name, SE_NO__c,ParentId,COUNTRY_FORM__c FROM Account where ParentId='"+id+"'",new AsyncResponder( function(qrNode:QueryResult):void { var childNodes:ArrayCollection = new ArrayCollection(); var scr_systemid:String; var se_number:String; var tempname:String; var size:String; if (qrNode.records != null) { for(var j:int =0; j < qrNode.records.length ; j++){ size=qrNode.records[j].SE_NO__c; //Alert.show('Size='+size.length); if(size.toString().length>10) { scr_systemid=qrNode.records[j].SE_NO__c.substring(10,13); se_number=qrNode.records[j].SE_NO__c.substring(0,10); tempname=qrNode.records[j].ACCT_HIER__c+' '+scr_systemid+' '+se_number+' '+qrNode.records[j].Name+' '+qrNode.records[j].COUNTRY_FORM__c+' '+qrNode.records[j].ACCT_STATUS__c; } if(size.toString().length==10) { //scr_systemid=qrNode.records[j].SE_NO__c.substring(9,12); //se_number=qrNode.records[j].SE_NO__c.substring(0,9); tempname=qrNode.records[j].ACCT_HIER__c+' '+qrNode.records[j].SE_NO__c+' '+qrNode.records[j].Name+' '+qrNode.records[j].COUNTRY_FORM__c+' '+qrNode.records[j].ACCT_STATUS__c; } childNodes.addItem(new TreeNode(qrNode.records[j].Id,tempname,force)); //dependent=qrNode.records.length; } children = childNodes; dependent=children.length; Name = '['+dependent+']'+' '+name; //Alert.show('The current Node is : ' + Name + ' the number of child nodes are ' + childNodes.length); } else { //Name = name; children=null; } },function(result:Object):void{//Alert.show("Error: " + result.toString() } )); } public var id:String; public var Name:String; public var dependent:int; //public var children : ArrayCollection=new ArrayCollection(); public var children : ArrayCollection; /*public function indexfinder(node : clsTreeNode,se_id:String) : void { for(i:int=0;i<node.children.length;i++) { if(se_id==node.children.) } // children.addItem(node); }*/ public function setChildren(nodes : ArrayCollection) : void { if (this.children == null) this.children = new ArrayCollection(); children = nodes; } public function getChildren():ArrayCollection { return children; } } } -- Thanks Abhik Sarkar -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.