5 Replies Latest reply on Aug 9, 2007 11:37 AM by ntsiii

    Tree.expandItem method

    djhall77
      I have a Tree with the following data provider behind it:

      <mx:XML id="siteContentData" xmlns="">
      <content>
      <site label="Design Patterns Spring 2006 (k8921)" isBranch="true">
      <page label="k8921 Home" isBranch="true">
      </page>
      </site>
      </content>
      </mx:XML>

      The following method handles the creationComplete event of the Tree:

      private function initSiteContentTree():void {
      var root:Object = siteContentTree.dataProvider.getItemAt(0);
      var child:XMLList = root.site;
      siteContentTree.expandItem(child, true);
      }

      Any idea why this isn't working?
        • 1. Re: Tree.expandItem method
          Nataliefay
          Hi,

          I'm sorry to bug you with a non-technical discussion, but I am a recruiter in San Diego. My client is in need of 3 Senior Flex Developers for their project. I have had an extremely rough time finding someone for this position. Would you be interested in this position, or do you know of anyone that might be? We do pay referral fees. This position may be open to telecommuting.

          Job Description:
          They are in the midst of a major re-architecting of their Corporate Management system utilizing many cutting edge technologies. As it relates to the position they are using Flex as their UI.

          This is either a contract, or a full-time position.

          Pay: Market Rate

          Thanks for your help!

          Natalie Fay
          Outsource Technical
          www.ostechnical.com
          nfay@ostechnical.com
          858.874.5637
          • 2. Re: Tree.expandItem method
            Nataliefay Level 1
            Hi,

            I'm sorry to bug you with a non-technical discussion, but I am a recruiter in San Diego. My client is in need of 3 Senior Flex Developers for their project. I have had an extremely rough time finding someone for this position. Would you be interested in this position, or do you know of anyone that might be? We do pay referral fees. This position may be open to telecommuting.

            Job Description:
            They are in the midst of a major re-architecting of their Corporate Management system utilizing many cutting edge technologies. As it relates to the position they are using Flex as their UI.

            This is either a contract, or a full-time position.

            Pay: Market Rate

            Thanks for your help!

            Natalie Fay
            Outsource Technical
            www.ostechnical.com
            nfay@ostechnical.com
            858.874.5637
            • 3. Re: Tree.expandItem method
              Josh Johnson Level 1
              So apart from the inappropriate technical recruiter notes, here's an attempt to actually answer the question.

              You're calling 'child' in the expandItem() function, but that entry is expecting and object, but you're passing it an XMLList. If you instead changed it so child was actually a particular entry in the XMLList, it should conceivably work.
              • 4. Re: Tree.expandItem method
                ntsiii Level 3
                Yes, that could be the problem, try this:
                var child:XML = root.site[0];

                Also, siteContentTree.dataProvider is already at the root of the xml so you should not need the getItemAt()

                Do a trace(siteContentTree.dataProvider.toXMLString() ) to verify exactly what you have.

                One final thing. I doubt it is the case in your scenario, but if you are assigning the dataProvider in AS code, then sometimes you have to wait a "frame" for the UI to be redrawn, before you can manupulate the ui elements, as you are doing with expandItem. Usually this is not a problem if you are binding the dataprovider.

                You "wait a frame" by using callLater() to invoke the expandItem. I have an example on cflex.net, search for "tree"

                Tracy
                • 5. Re: Tree.expandItem method
                  ntsiii Level 3
                  Natalie, it is prqctically useless to hijack a thread with a notice like this since often only the people directly involved with the thread will see it.

                  Few of us mind a single posting of Flex oriented opportunities, but please be smart about it.

                  Post also on cflex.net, yahoogroups flexcoders, and especially:
                  http://tech.groups.yahoo.com/group/flexjobs/

                  Tracy