9 Replies Latest reply on Dec 11, 2008 9:50 AM by ntsiii

    Object Object displaying in my tree control

    madhooper Level 1
      I verified that my arrarycollection is being returned from the database correctly but my tree control displays object Object.

      Can anyone offer any suggestions?
        • 1. Re: Object Object displaying in my tree control
          ntsiii Level 3
          Did you define a labelField or labelFunction()?
          Tracy
          • 2. Re: Object Object displaying in my tree control
            madhooper Level 1
            Yes, I defined a labelfield (sections) which is one of the labels.

            I didn't define a label function.
            • 3. Re: Object Object displaying in my tree control
              Gregory Lafrance Level 6
              Check your e4x syntax.
              • 4. Re: Object Object displaying in my tree control
                gallaharsha
                Hi,
                could you post the sample arraycollection, we could make it work properly..
                • 5. Re: Object Object displaying in my tree control
                  madhooper Level 1
                  I attached the code for the tree and below is a sample of the array that is returned.
                  Object)#0
                  hierarchy = (Object)#1
                  0000001 = (Object)#2
                  id = "0000001"
                  image = "0000001.png"
                  label = "ENGINE GROUP (1/2)"
                  level = "1"
                  sections = (Object)#3
                  1101 = (Object)#4
                  id = "1101"
                  image = "1101.png"
                  label = "1101 ENGINE ASSY"
                  level = "2"
                  sections = (Object)#5
                  1101002A = (Object)#6
                  id = "1101002A"
                  image = "1101002A.gif"
                  label = "1101002A 1101 ENGINE ASSY (9202-9704)5K [ASSY]"
                  level = "3"
                  sections = (Array)#7
                  1101006 = (Object)#8
                  id = "1101006"
                  image = "1101006.gif"
                  label = "1101006 1101 ENGINE ASSY (9202-9704)5K [SHORT BLOCK ASSY]"
                  level = "3"
                  sections = (Array)#9
                  1101078B = (Object)#10
                  id = "1101078B"
                  image = "1101078B.gif"
                  label = "1101078B 1101 ENGINE ASSY (9202-9704)5K [KIT]"
                  level = "3"
                  sections = (Array)#11
                  1101093 = (Object)#12
                  id = "1101093"
                  image = "1101093.gif"
                  label = "1101093 1101 ENGINE ASSY (8104-9704)"
                  level = "3"
                  sections = (Array)#13
                  • 6. Re: Object Object displaying in my tree control
                    Level 7

                    "madhooper" <webforumsuser@macromedia.com> wrote in message
                    news:ghrctr$egn$1@forums.macromedia.com...
                    >I attached the code for the tree and below is a sample of the array that is
                    > returned.
                    > Object)#0
                    > hierarchy = (Object)#1
                    > 0000001 = (Object)#2
                    > id = "0000001"
                    > image = "0000001.png"
                    > label = "ENGINE GROUP (1/2)"
                    > level = "1"
                    > sections = (Object)#3
                    > 1101 = (Object)#4
                    > id = "1101"
                    > image = "1101.png"
                    > label = "1101 ENGINE ASSY"
                    > level = "2"
                    > sections = (Object)#5
                    > 1101002A = (Object)#6
                    > id = "1101002A"
                    > image = "1101002A.gif"
                    > label = "1101002A 1101 ENGINE ASSY (9202-9704)5K [ASSY]"
                    > level = "3"
                    > sections = (Array)#7
                    > 1101006 = (Object)#8
                    > id = "1101006"
                    > image = "1101006.gif"
                    > label = "1101006 1101 ENGINE ASSY (9202-9704)5K [SHORT BLOCK
                    > ASSY]"
                    > level = "3"
                    > sections = (Array)#9
                    > 1101078B = (Object)#10
                    > id = "1101078B"
                    > image = "1101078B.gif"
                    > label = "1101078B 1101 ENGINE ASSY (9202-9704)5K [KIT]"
                    > level = "3"
                    > sections = (Array)#11
                    > 1101093 = (Object)#12
                    > id = "1101093"
                    > image = "1101093.gif"
                    > label = "1101093 1101 ENGINE ASSY (8104-9704)"
                    > level = "3"
                    > sections = (Array)#13
                    >
                    >
                    > <mx:Panel label="Index"
                    > icon="@Embed(source='../assets/images/icons/Alpha_Index.png')">
                    > <mx:Canvas label="Index" width="100%" height="100%"
                    > backgroundColor="0xbFFFFFF"
                    > borderColor="0xFFFFFF" borderThickness="5"
                    > borderStyle="solid">
                    > <mx:RadioButton x="8" y="3" label="Expand All"/>
                    > <mx:RadioButton x="104" y="2" label="Collapse"/>
                    > <mx:RadioButton x="202" y="3" label="Restore"/>
                    > <mx:Label x="0" y="30" text="Filter by Section"/>
                    > <mx:TextInput x="101" y="28" width="219"/>
                    > <mx:Tree id="partsTree" labelField="sections" x="10" y="56"
                    > width="354" height="239" dataProvider="{tree}">
                    > </mx:Tree>
                    > </mx:Canvas>
                    > </mx:Panel>

                    Since sections always seems to be an array in your hierarchy, exactly what
                    label did you think you were going to see by specifying that field as a
                    labelField?


                    • 7. Re: Object Object displaying in my tree control
                      madhooper Level 1
                      I'd like to see "label"
                      • 8. Re: Object Object displaying in my tree control
                        Level 7

                        "madhooper" <webforumsuser@macromedia.com> wrote in message
                        news:ghrdol$fjq$1@forums.macromedia.com...
                        > I'd like to see "label"

                        Then just use a labelFunction that always returns "label". Not sure how
                        useful it is, but if that's what you want...


                        • 9. Re: Object Object displaying in my tree control
                          ntsiii Level 3
                          That labelField is why you are seeing [Object object]. This displays when you attempt to display a complex Object in a control that needs a string. An array can't be displayed as a label.

                          Amy answerered your question, but I don't think that is really what you want:
                          label
                          label
                          label
                          label
                          .....

                          Do you mean you want to see the contents of the label property?
                          Engine Group
                          1101 Engine assy
                          ...

                          if so, specify labelField="label"

                          Tracy