2 Replies Latest reply on Apr 28, 2009 12:22 AM by rjoshicool

    HierarchicalData in Flex

    rjoshicool Level 2

      Hi,

       

      I want to read an XML file and put the result in a HierarchicalData type object.

      i had followed this link- http://livedocs.adobe.com/flex/3/html/help.html?content=advdatagrid_07.html for implementing it but am not able to get the similar tree like structure. I am not able to get the exact XML structure which would make similar layout.

        • 1. Re: HierarchicalData in Flex
          Barna Biro Level 3

          Hi,

           

          Could you maybe post the XML structure you are working with? It's quite hard to give you an exact answer because I don't really know where you got stuck. The example from the link you have posted can't really get clearer than that, the whole HierarchicalData thing is quite simple because in essence, you still are still dealing with a DataGrid. Make sure that you add your dataProvider it looks something like: dataProvider="{new HierarchicalData(dpHierarchyXML)}" and everything should be fine.

           

          Again, posting your XML structure would help a lot.

           

          Best regards,

          Barna Biro

          • 2. Re: HierarchicalData in Flex
            rjoshicool Level 2

            Hi,

             

            I have attached the XML file which I am using and a screenshot of what I want to get as output, by reading content from that XML file. Currently I am getting this output by using an array collection like -

             

            private var dpa:ArrayCollection = new ArrayCollection([
                    {childSkill:"Parent", child: [
                   
                    {childSkill:"First Child", relationType:"Parent-Child Relationship", description:"Some Description", child: [
                    {childSkill:"First Sub Child", relationType:"Child-Sub Relationship", description:"Some Description", child: [
                    {childSkill:"First Sub Child", relationType:"Child-Sub Relationship", description:"Some Description"}]},
                    {childSkill:"Second Sub Child", relationType:"Child-Sub Relationship", description:"Some Description"}]},
                           
                    {childSkill:"Second Child", relationType:"Parent-Child Relationship", description:"Some Description", child: [
                    {childSkill:"Third Sub Child", relationType:"Child-Sub Relationship", description:"Some Description"},
                    {childSkill:"Fourth Sub Child", relationType:"Child-Sub Relationship", description:"Some Description"}]}
                           
                    ]}
                    ]);

             

            But I want to get the similar output(tree structure) by reading data from an XML file

            advDG.jpg

             

            The content in my XML file is:

             

            <myroot>
                <skillName>Parent</skillName>
                <skill>
                    <skillName>First Child</skillName>
                    <relationType>Parent-Child</relationType>
                    <description>First Child Description</description>
                    <skill>
                        <skillName>First Sub Child</skillName>
                        <relationType>Child-Sub</relationType>
                        <description>First Sub Child Description</description>
                    </skill>
                    <skill>
                        <skillName>First Sub Child</skillName>
                        <relationType>Child-Sub</relationType>
                        <description>First Sub Child Description</description>
                    </skill>
                </skill>
                <relationType>Child-Sub</relationType>
                <description>First Sub Child Description</description>
            </myroot>