Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing tree hierarchy to Flex from ColdFusion CFC

Status
Not open for further replies.

csteinhilber

Programmer
Aug 2, 2002
1,291
0
0
US
Currently running Flex 1.5. Eventually we'll move to 2.0, which may or may not solve this issue... but for now...

I'm trying to create a hierarchy in a ColdFusion CFC to pass into Flex for use as a dataprovider for a (standard) Tree control.

So I produce an array of structs (objects), with or without children. The final node in a branch containing a data object with several attributes. The problem is that when that last node is displayed in the Flex Tree, it has a child element (ie - it's expandable) that contains an undefined object.

I've tried various combinations of using _remoteClass = "Object", but I still get this phantom final node.

As I've worked through this problem, I've gotten my test data down to a pretty bare minimum (hard-coded... just a single node with a child):

Code:
<cfscript>
	aryFinalTreeHierarchy = ArrayNew(1);
	
	strNodeDescription["_remoteClass"] = "Object";
	strNodeDescription["label"] = "Node 1";
	strNodeDescription["children"] = ArrayNew(1);
	
	strChildDescription = StructNew();
	strChildDescription["_remoteClass"] = "Object";
	strChildDescription["label"] = "Child 1";

	strChildDescription["data"] = StructNew();
	strChildDescription.data["_remoteClass"] = "Object";
	strChildDescription.data["doctype"] = "File";
	strChildDescription.data["docsku"] = "GSF345";
	
	ArrayAppend(strNodeDescription.children,strChildDescription);
	
	ArrayAppend(aryFinalTreeHierarchy,strNodeDescription);
</cfscript>

and when I set my Flex Tree's dataprovider to this array, I get the following displayed in Flex:

Code:
 + Node 1
 --+ Child 1
 ----+ [object Object], 1, , [object Object], null


Anyone know what I might be doing wrong? Or what I need to do to get rid of that last node?


Thanks in advance,
-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top