0

This is where I call the HierarchicalData

    <component:MyHierarchicalData source="{dpHierarchy}" childrenField="children"/>

dpHierarchy contains a list of Radio.

And My Object Radio contains two lists :

public class RadioRds implements IDisplayable
    {
        private var _id     :int;
        public var name     :String;
        public var **docers**   :ArrayCollection;   // <Encoder>
        public var **charges**  :ArrayCollection;   // <RadioRds>
    }

Those thow list have the same level and they appear under the a label "name"

This is my extended class

package test.view.component
{
    import mx.collections.HierarchicalData : 

    public class MyHierarchicalData extends HierarchicalData
    {
        public var children:* = null;

        public function MyHierarchicalData(value:Object=null) {
            super(value);
        }

        override public function getChildren(node:Object):Object {
            var children:* = null;
            // ???
        return children;
    }

}

}

I don't know what to do in the overriden function. should I concat the two list? How can I do it?

ErEcTuS
  • 777
  • 1
  • 14
  • 33
  • I'm not sure what you're trying to do. I don't think a chilkdrenField can be an arrayCollection; it is just a string; which represents the name of the property from your dataPRovider that represents the children. – JeffryHouser Jun 25 '12 at 12:39
  • thanks for your response. Yes, the childrenField is a String representing the childrens. I am using the key word "children" childrenField="children"/> . My problem here is that I have two children (two another sub list) which has different objects types – ErEcTuS Jun 25 '12 at 12:49
  • You can't have two children, so far as I know. But you may be able to work around that by creating your own class that implements the IHierarchicalData interface: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/collections/IHierarchicalData.html . the getChlldren method will have to combine your two arrays and return them. – JeffryHouser Jun 25 '12 at 13:02
  • Hi again. I have edited my first post..maybe it's more clear so you can can give me easily a hint about what to do – ErEcTuS Jun 25 '12 at 13:52
  • http://stackoverflow.com/questions/2575158/merge-2-arraycollection-flex-3 – JeffryHouser Jun 25 '12 at 13:57
  • I have merged the two lists, but I had a stack overflow error and the web page freezes – ErEcTuS Jun 25 '12 at 14:22
  • It maybe because the Object is containing a list of the same object type – ErEcTuS Jun 25 '12 at 14:29
  • Thanks a lot Flextras. It works. Great blog too ;) – ErEcTuS Jun 25 '12 at 14:57
  • You should post up your solution as a formal answer, then. I'm glad I helped. – JeffryHouser Jun 25 '12 at 15:51

0 Answers0