Definitely had to do with an event being fired…but whats odd was there was still *some* reaction by the component…it just moved the items to the root of the tree. Anyhow I reset the dataprovider after the XML model was changed and it’s working just fine now. Perhaps a more elegant way to accomplish this but after a couple hours of fiddling..I gotta move on. ;-)

 

Thanks for the input!

Stace

 


From: [email protected] [mailto:[email protected]] On Behalf Of Jeff Conrad
Sent: Wednesday, October 26, 2005 7:05 PM
To: [email protected]
Subject: RE: [flexcoders] Can't Seem to removeNode properly from a Tree!

 

Try running .updateControl() on the tree in question and see if that helps with redrawing.  I know that (apparently undocumented) method worked for me in the MX04 v2 components.  I found that by digging through the MX04 v2 components source.

 

My guess is it’ll probably work (at least in 1.5 – 2.0 looks like it might be a big rewrite).

 

Maybe someone else knows a better way to accomplish that.

 

Hope that helps/works,

 

Jeff

 


From: [email protected] [mailto:[email protected]] On Behalf Of Stacy Young
Sent: Wednesday, October 26, 2005 6:48 PM
To: [email protected]
Subject: RE: [flexcoders] Can't Seem to removeNode properly from a Tree!

 

One step further…that code snippet *is* working…the dataprovider for the tree is changed…the nodes *are* removed…I believe it’s the tree component that’s not refreshing properly. I’ve tried redraw and broadcasting modelChanged, change events to no avail…

 

-Stace

 


From: [email protected] [mailto:[email protected]] On Behalf Of Stacy Young
Sent: Wednesday, October 26, 2005 5:22 PM
To: [email protected]
Subject: RE: [flexcoders] Can't Seem to removeNode properly from a Tree!

 

Tried this variation, same result…removes a folders child nodes but leaves the folder…don’t get it !!

 

var dp = view.profileFields.dataProvider;

 

for (var locNode :XMLNode = dp.firstChild; locNode != null;)

{

var exclude :Boolean = false;

      if ( locNode.toString() == nodes[0].toString() )

      {

            trace("TRUE");

            exclude = true;

      }

      var nextNode = locNode.nextSibling;

      if( exclude )

      {

            locNode.removeNode();

      }

      locNode = nextNode;

}

 


From: [email protected] [mailto:[email protected]] On Behalf Of Stacy Young
Sent: Wednesday, October 26, 2005 3:29 PM
To: [email protected]
Subject: [flexcoders] Can't Seem to removeNode properly from a Tree!

 


I'm attempting to loop through childNodes on a tree dataprovider and
delete the currently selected node in that tree.

The tree's structure is fixed in that there is a series of child
elements in which each child may be one level deep.

When I execute the code below on an item off the root, its children are
deleted but the folder itself remains ??

Also, if it is a leaf I'm deleting it magically gets moved to the root
of the tree, yet is not deleted??

I must be missing something obvious here...any help would be much
obliged!

In the code snippet below, sections is the array of childnodes off the
root.

// Loop over sections
for(var i:Number=0; i<sections.length; i++)
{
      trace("step2");
      var fields = sections[i].childNodes;
      if( nodes[x] != sections[i] )
      {
            trace("step3");
            // Loop over fields
            for(var y:Number=0; y<fields.length; y++)
            {
                  trace("step4");
                  if( nodes[x] == fields[y] )
                  {
                        trace("step6: delete field");
                        var field :XMLNode = fields[y];
                        field.removeNode(); // Remove field
                        break;
                  }
            }
      } else {
            trace("step5: delete section");
            // Delete section
            sections[i].removeNode();
            break;
      }
}







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to