Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex Populating Tree Control From DataSet
    primarykey
    data
    text
    <p>Am currently working on a Tree control, and being my first time to delve into this, I need your inputs and advice.</p> <p>My tree control is retrieving data from a .NET web service. My .NET webservice returns a string which is parsed from a dataset via the command DataSet.GetXML method.</p> <pre><code>Function MyFunc() as String 'Populate the dataset here '....... Return DataSet.GetXML() End Function </code></pre> <p>In my flex application, I am converting the string value returned by the webservice into an XML:</p> <pre><code>private var _xmlMyData:XML; private function myResultHandler(event:ResultEvent) :void { _xmlMyData = XML(event.result); // This script to view the XML data in Text Area var strData:String = String(event.result); taData.text = strData; } </code></pre> <p>Which I am then passing to my xmlListCollection control</p> <pre><code>&lt;mx:XMLListCollection id="xmllc_myData" source="{_xmlMyData.Table}" /&gt; &lt;mx:TextArea id="taData" width="300" height="100" /&gt; </code></pre> <p>Then binding to my tree control:</p> <pre><code>&lt;mx:Tree id="treeOffshore" dataProvider="{xmllc_myData}" labelField="DESCN" showRoot="false"&gt; &lt;/mx:Tree&gt; </code></pre> <p>When viewing the data in the text area control, I have the following:</p> <pre><code>&lt;NewDataSet&gt; &lt;Table&gt; &lt;CODE&gt;A1&lt;/CODE&gt; &lt;DESC&gt;Area One&lt;/DESC&gt; &lt;/Table&gt; &lt;Table&gt; &lt;CODE&gt;B2&lt;/CODE&gt; &lt;DESC&gt;Base Two&lt;/DESC&gt; &lt;/Table&gt; &lt;Table&gt; &lt;CODE&gt;C4&lt;/CODE&gt; &lt;DESC&gt;Class Four&lt;/DESC&gt; &lt;/Table&gt; &lt;Table&gt; &lt;CODE&gt;D8&lt;/CODE&gt; &lt;DESC&gt;Demo Eight&lt;/DESC&gt; &lt;/Table&gt; &lt;/NewDataSet&gt; </code></pre> <p>This is how the treeview renders:</p> <pre><code>Area One A1 Area One Base Two B2 Base Two Class Four C4 Class Four Demo Eight D8 Demo Eight </code></pre> <p>What I want is to be able to define the Description only at the first level only:</p> <pre><code>Area One Base Two Class Four Demo Eight </code></pre> <p>The next thing that I need to accomplish is that the second level of the treeview should actually be populated based on the CODE from the first level.</p> <p>For example:</p> <pre><code>Area One Sub Item Area One Sub Item Area Two Base Two Sub Item Base Two Sub Item Base Three Sub Item Base Four Class Four Sub Item Class Four Demo Eight Sub Item Demo Eight Sub Item Demo Nine Sub Item Demo Ten Sub Item Demo Eleven </code></pre> <p>I am quite new in this tree control thing (as well as flex) and have limited grasp of the concepts to be able to accomplish this.</p> <p>I am thinking either of modifying the XML data which I originally retrieve and probably insert the sub items per each node, although I am in a bind of how to accomplish the same.</p> <p>On the other hand, to give some of you further details, the treeview data would actually be coming from three tables where the table 1 is the base table, and the table 2 contains the children of table 1 and table 3 contains children data from table 3.</p> <p>I would sincerely appreciate your inputs on this. I am foraying into the world of Flex and this is quite a make or break scenario towards embracing this technology in our organization.</p> <p>Thanks and hoping to get some good advice on how to accomplish this.</p> <p>Regards,</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload