Expand my Community achievements bar.

How to get data from webservice into tree component

Avatar

Level 1

Hi gays,

I am trying to bind tree component throuth webservice method and i had set <dataprovidor> to tree control ,but only Root nodes are binded.

Now i want to add child nodes to tree ,but i have no idea for it.

now i using:--

<mx:Tree

x="10" y="10" height="90%" width="70%" dataProvider="{wsImthePM.getOperation('GetAllTasksByProject').lastResult};" id="trprjtask" labelField="TaskName"

>

</mx:Tree>

please solve my problem.

1 Reply

Avatar

Level 10

here is a sample code to bind/add childs to the tree component:

for each(var childObj:Object in web_service_name.operation_name.lastResult.child_name)

{

     var childNode:Object = new Object();

     childNode['label'] = childObj['label_attribute_name'];

     childNode['data'] = childObj['data_attribute_name'];

     IList(trprjtask.dataProvider).addItem(childNode);

}

Please replace the web_service_name, operation_name etc with actual values...

If unsuccess, send your wsdl and mxml. i will try to help you.

Nith