Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
jj3001 #1
How to populate tree with result of webservice return?
I have one webservice I called to return list of division Id and name, and I
need to pupolate it to a tree which tah labe is divsion name and data is
division ID. How can I do it?
here is the code:
================================================== ================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
initialize="getDivList();">
<mx:Script>
<![CDATA[
function getDivList():Void {
divWS.getDiv.send();
}
]]>
</mx:Script>
<mx:WebService id="divWS" wsdl="http://localhost:8500/webApp/div.cfc?wsdl"
showBusyCursor="true"
fault="mx.controls.Alert.show(event.fault.faultstr ing)" />
<mx:HBox>
<mx:Panel>
<mx:Tree id="divTree" width="300" height="200"
dataProvider="{divWS.getDiv.result}" />
</mx:Panel>
</mx:HBox>
</mx:Application>
==========================
I know this is not going to work. But how can i use the XML object to populate
the tree?
Thank you so much...
jj3001 Guest
-
Help:How to populate CFC result to a Tree?
I have one webservice I called to return list of division Id and name, and I need to pupolate it to a tree which the display is divsion name and the... -
How to populate a tree component from a dataset
Hi, Could anyone tell me how to go about getting fields from a dataset component (bound to a web service) into a tree component. Any help... -
DataGris won't populate from WebService call
I can't get my datagrid to populate from my web service. My web service is a ColdFusion CFC. I get no errors but a blank datagrid. What am I doing... -
Re-populate form on page return
I hope this makes sense. I have an application that allows the user to set priorities for a sales force. The page lists each client per row from a... -
Making PHP return SQL result to a different page
Hi I have a Microsoft SQL database I can use (also mySQL, so if you know how to do this in mySQL that is just as useful). The database can only be... -
Jason R. Weiss #2
Re: How to populate tree with result of webservice return?
jj3001 wrote:
Well, without seeing the format of the SOAP envelope contents, it's hard> ==========================
> I know this is not going to work. But how can i use the XML object to populate
> the tree?
> Thank you so much...
>
for me to give you a specific example of walking the data that comes
back from your web service. However, here are some basic things to
consider:
1) The treeview "node" doesn't have to be called "node" in the XML. In
fact, it can be called anything you want.
2) There doesn't even have to be a "label" attribute on each node
3) You don't have to shove your data into a single "data" attribute either.
Best practices:
a) don't nest properties in a child node- each node should contain all
is necessary properties (attributes).
b) All the nodes should have identical properties (attributes) for
consistency
Here is a robust example that proves all of these things. I define my
XML using a hierarchical data set, but with consistent attributes. I
told my tree control to use the labelField "firstName" for the label.
(If I needed a compound name, I could have used labelFunction and wrote
some actionscript to be really creative, like make it display last,
first or something).
Run it, look it over, and if you have a more specific question please
post it under a new thread.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
<![CDATA[
function changeEvt(event)
{
alert(event.target.selectedItem.attributes.lastNam e,
event.target.selectedItem.attributes.employeeId, mx.controls.Alert.OK);
}
]]>
</mx:Script>
<mx:Tree labelField="firstName" id="theTree" width="300" height="200"
change="changeEvt(event)">
<mx:dataProvider>
<mx:XML>
<employee firstName="Jasons" lastName="Weiss" employeeId="1">
<employee firstName="Dave" lastName="Thomas" employeeId="2"/>
<employee firstName="Nancy" lastName="Nurset" employeeId="3"/>
</employee>
<employee firstName="Joe" lastName="Schmo" employeeId="4">
<employee firstName="Judy" lastName="Dargo" employeeId="5"/>
</employee>
</mx:XML>
</mx:dataProvider>
</mx:Tree>
</mx:Application>
HTH,
Jason
--
Jason Weiss
Cynergy Systems, Inc.
Macromedia Flex Alliance Partner
[url]http://www.cynergysystems.com[/url]
Email: [email]jason.weiss@cynergysystems.com[/email]
Office: 866-CYNERGY
Mobile: 1.832.444.2246
Jason R. Weiss Guest



Reply With Quote

