A TreeDataProvider cannot be an array.  It has to be a single object that has a child array.  So try creating an object like this:

 

Var treeDetails:Object = {label: ‘root’};

treeDetails.children = treeList;

 

get the array of details back:

 

var arr:Array = treeCmp.dataProvider.getProperty(“children”);

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of Arunkumar S
Sent: Thursday, October 27, 2005 4:45 AM
To: [email protected]
Subject: [flexcoders] Problem with type casting a TreedataProvider back to array...

 

Hi all,

 

I am assigning an array as TreedataProvider.

 

When i'm moving the position of nodes of the tree (using addTreeNodeAt  /  removeTreeNodeAt), the dataProvider is not updated to the changed nodes, so i'm explicitly typecasting and assignig back to array.

 

This seems to behave abnormally (undefined node added to the tree at the top)...

 

Here are some pieces of code i use....

 

 

var treeDetails  : Array; // This is assigned as the dataProvider for the tree

:

:

treeDetails = treeList; // treeList is a array got from Java which has HashMaps at each row

:

:

// After moving nodes treeDetails is

treeDetails = mx.utils.ArrayUtils.toArray(treeCmp.dataProvider) ; //treeCmp is tree's ID

 

 

Then i'm passing back treeDetails to Java, i'm getting "Error: An error occurred during service invocation". While assigning dataProvider to treeDetails i can notice that a undefined node added to the top.

 

Also i noticed that when using a simply array in flex every thing is working fine, and when the array contains object dataProvider is not updated and also i'm getting error in java when typecasting and send it as array.

 

Can anyone give me an idea what could have caused the problem. Please give me a solution.

 

Thanks in advance.

 

Regards,

Arun.


Yahoo! FareChase - Search multiple travel sites in one click.


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to