Jeff
I
appreciate the response , but i think i didn't explain myself very well ,
I know
i can implement the API , and i know i can write a method that loads the tree ,
BUT -
there is an easy way to do this by assigning the result of the Web
Service as the DataProvider of the Tree.
the
only problem is that i found that you have to access an object called
backingObject (macromedia internal)
and
macromedia guys say there is more formal way doing this , which i failed to do
.
in
short here is the code. you can see the reference to this object if you remove
it IT WON'T WORK.
<mx:script>
function myLabelFunc(item):String {
var type=typeof item;
if (item.backingObject.filterName == null){
return item.backingObject.categoryName;
}else{
return item.backingObject.filterName + ", " + item.backingObject.filterGuid ;
}
}
var type=typeof item;
if (item.backingObject.filterName == null){
return item.backingObject.categoryName;
}else{
return item.backingObject.filterName + ", " + item.backingObject.filterGuid ;
}
}
</mx:script>
<mx:WebService id="UserCategoriesWS"
result="onResult(event)"
wsdl="@ContextRoot()/services/UserCategoriesWS?wsdl"
showBusyCursor="true"
fault="alert(event.fault.faultstring)">
<mx:operation name="getUserFilterCategories">
<mx:request>
<userName>userName</userName>
</mx:request>
</mx:operation>
</mx:WebService>
showBusyCursor="true"
fault="alert(event.fault.faultstring)">
<mx:operation name="getUserFilterCategories">
<mx:request>
<userName>userName</userName>
</mx:request>
</mx:operation>
</mx:WebService>
<mx:Tree id="filterTree" labelFunction="myLabelFunc"
dataProvider="{UserCategoriesWS.getUserFilterCategories.result}" width="100%"
height="100%" fontSize="10"/>
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Krueger
Sent: Wednesday, April 20, 2005 21:04
To: [email protected]
Subject: RE: [flexcoders] How to populate tree control from web service re sult (server side java objects)
I think what you want to do is create
a object that implements the TreeDataProviderAPI. In this object it will
be responsible for calling your webservice and get that data back and put it
into AS objects. Then create your tree. At any given node you can
have additional information. So in the DATA part of each node stick your
AS object. Then when the user clicks on a node , you will have a AS object
that represents your java object that you can do something with. That
being said I have tried to implement the TreeDataProviderAPI and was frustrated
by it and the lack of documentation. I was trying to create a lazy fetch
tree control. And trying to figure out the events, and the way everything
is linked can be difficult
Jeff
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

