So I resolved this issue.. The problem was that
MyModel.getInstance().activies = the XMLList() was getting populated
in the creationComplete event of the VBox container.
I moved the call that populated that out and in the login onResult function.
This worked like a charm.

Thanks Steve! I appreciate your help.





On Thu, Apr 10, 2008 at 3:00 PM, Greg Morphis <[EMAIL PROTECTED]> wrote:
> Not sure why it's not working for me, we seem to be doing the exact
>  same thing... I'll try again a little later.
>
>  Thanks Steve
>
>
>
>  On Thu, Apr 10, 2008 at 11:08 AM, Steve Ashton <[EMAIL PROTECTED]> wrote:
>  > Hi Greg,
>  >
>  >  In my example I am using an XMLList as well, but the 'get
>  >  filteredCollection()' function wraps the XMLList in an
>  >  XMLListCollection, as well as setting the filter function.  Here's
>  >  all the code I was using as my example.  Note, to make nodes appear
>  >  and disappear, select them in the 2nd tree, then click either Hide or
>  >  Show to affect the visibily of the nodes in the first list.
>  >
>  >
>  >  <?xml version="1.0" encoding="utf-8"?>
>  >  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
>  >  xmlns:local="*"
>  >         >
>  >
>  >         <mx:HBox width="100%">
>  >                 <mx:Tree id="tree1"
>  >  dataProvider="{filteredCollection}" labelField="@label" />
>  >                 <mx:VBox width="50%" >
>  >                         <mx:Tree id="tree2" dataProvider="{myxml}"
>  >  labelField="@label" />
>  >                         <mx:HBox>
>  >                                 <mx:Button label="Hide Node"
>  >  click="[EMAIL PROTECTED] = 'false'" />
>  >                                 <mx:Button label="Show Node"
>  >  click="[EMAIL PROTECTED] = 'true'" />
>  >                         </mx:HBox>
>  >                 </mx:VBox>
>  >         </mx:HBox>
>  >
>  >
>  >         <mx:Script>
>  >                 <![CDATA[
>  >                         import mx.collections.XMLListCollection;
>  >
>  >
>  >
>  >  private function filterInvisibleNode(item:Object):Boolean {
>  >  if( item != null && [EMAIL PROTECTED] == 'true'){
>  >         return true;
>  >  }
>  >  else {
>  >         return false;
>  >  }
>  >  }
>  >
>  >  private function get filteredCollection():XMLListCollection {
>  >  var col:XMLListCollection = new XMLListCollection( myxml );
>  >  col.filterFunction = filterInvisibleNode;
>  >  col.refresh();
>  >  return col;
>  >  }
>  >
>  >                 ]]>
>  >         </mx:Script>
>  >
>  >
>  >
>  >
>  >         <mx:XMLList id="myxml" >
>  >                 <node label="Parent 1" isvisible="true"  >
>  >                         <node label="Child 1-A" isvisible="true" >
>  >                                 <node label="Grandchild 1-A-a"
>  >  isvisible="true" />
>  >                                 <node label="Grandchild 1-A-b"
>  >  isvisible="true" />
>  >                         </node>
>  >                 </node>
>  >                 <node label="Parent 2" isvisible="true" >
>  >                         <node label="Child 2-A" isvisible="true" >
>  >                                 <node label="Grandchild 2-A-a"
>  >  isvisible="true" />
>  >                                 <node label="Grandchild 2-A-b"
>  >  isvisible="true" />
>  >                         </node>
>  >                 </node>
>  >                 <node label="Parent 3"  isvisible="true">
>  >                         <node label="Child 3-A" isvisible="true" >
>  >                                 <node label="Grandchild 3-A-a"
>  >  isvisible="true" />
>  >                                 <node label="Grandchild 3-A-b"
>  >  isvisible="true" />
>  >                         </node>
>  >                 </node>
>  >         </mx:XMLList>
>  >
>  >
>  >
>  >  </mx:Application>
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >  --- In [email protected], "Greg Morphis" <[EMAIL PROTECTED]>
>  >  wrote:
>  >  >
>  >
>  > > I believe it's due to the XML object being an XMLList rather than
>  >  > XMLListCollection..
>  >  > I read some lastnight on those but couldnt find a way to convert
>  >  the two.
>  >  > Just a bunch of postings about how the datagrid object "seemlessly"
>  >  > converts the two.
>  >  >
>  >  > The XML looks like
>  >  > <node label="acts">
>  >  >     <node label="work" isvisible="1">
>  >  >          <node label="opener" isvisible="1">
>  >  >          ....
>  >  >      </node>
>  >  >      <node label="vacation" isvisible="0">
>  >  >            <node label="personal_holiday" isvisible="0">
>  >  >            ...
>  >  >       </node>
>  >  > </node>
>  >  >
>  >  > I'll hit the sites again this AM and see if I can make some more
>  >  headway.
>  >  >
>  >  > Thanks
>  >  >
>  >  >
>  >  > On Thu, Apr 10, 2008 at 8:05 AM, Douglas Knudsen
>  >
>  > > <[EMAIL PROTECTED]> wrote:
>  >  > > I'm with Steve on this, I would think you should have been able
>  >  to use a
>  >  > > filter function on the dataProvider.  Setting the visible
>  >  property on a tree
>  >  > > node renderer would leave a gap there if it worked at all I would
>  >  think.
>  >  > >
>  >  > > DK
>  >  > >
>  >  > >
>  >  > >
>  >  > > On Thu, Apr 10, 2008 at 8:59 AM, Greg Morphis <[EMAIL PROTECTED]>
>  >
>  > wrote:
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > > I modified the SQL that generates the XML to exclude the ones I
>  >  wanted
>  >  > > > to not be visible but as proof of concept I wanted to try to do
>  >  it in
>  >  > > > Flex/AS.
>  >  > > > It's been a while since I've had a chance to play with Flex and
>  >  wanted
>  >  > > > to make this happen.
>  >  > > > Any help/examples with using itemRenderers would be helpful.
>  >  > > > This one is pure AS and only has a mouse_down event in it.
>  >  > > >
>  >  > > > Thanks
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > > On Wed, Apr 9, 2008 at 5:28 PM, Tracy Spratt <[EMAIL PROTECTED]>
>  >
>  > > > wrote:
>  >  > > > >
>  >  > > > >
>  >  > > > >
>  >  > > > > Greg, help me out here. If you make a node in a
>  >  tree 'invisible" exactly
>  >  > > > > what do you want to see? If that is really all you want, then
>  >  the
>  >  > > > > itemRenderer should be able to handle it.
>  >  > > > >
>  >  > > > >
>  >  > > > >
>  >  > > > > If you mean that the node should not be rendered at all, and
>  >  not take up
>  >  > > > > space in the tree layout, then I think you will have to do
>  >  this using a
>  >  > > > > custom DataDescriptor.
>  >  > > > >
>  >  > > > >
>  >  > > > >
>  >  > > > > Tracy
>  >  > > > >
>  >  > > > >
>  >  > > > > ________________________________
>  >  > > > >
>  >  > > > >
>  >  > > > > From: [email protected]
>  >  [mailto:[EMAIL PROTECTED] On
>  >  > > > > Behalf Of Greg Morphis
>  >  > > > > Sent: Wednesday, April 09, 2008 4:35 PM
>  >  > > > > To: [email protected]
>  >  > > > > Subject: Re: [flexcoders] Re: setting a tree node
>  >  visible=false?
>  >  > > > >
>  >  > > > >
>  >  > > > >
>  >  > > > >
>  >  > > > >
>  >  > > > >
>  >  > > > > Also the XML is an XMLList, not an XMLListCollection..
>  >  > > > > Is there a work around?
>  >  > > > >
>  >  > > > > On Wed, Apr 9, 2008 at 3:29 PM, Greg Morphis <[EMAIL PROTECTED]>
>  >
>  > wrote:
>  >  > > > > > Thanks for helping. I still can't get it.. Nothing displays
>  >  in the
>  >  > > tree
>  >  > > > > now.
>  >  > > > > > I thought maybe it was due to the isvisible being a 1 or 0
>  >  (but I'm
>  >  > > > > > sure Flex/AS knows that it's boolean value).
>  >  > > > > > Anyways I tried 'true' and tried '1'. I even reversed them
>  >  thinking
>  >  > > > > > that perhaps there was something wrong with the value.
>  >  > > > > >
>  >  > > > > > I even tried adding an Alert
>  >  > > > > > Alert.show(col.toString());
>  >  > > > > > and I got about 4 empty Alerts.
>  >  > > > > > So I wonder if it has to do with the time it's loading?
>  >  > > > > >
>  >  > > > > > The xml coming in looks like this..
>  >  > > > > > <node activity="LOA_Sick" label="LOA_Sick" isvisible="0">
>  >  > > > > > <node activity="LOA_Sick" label="Sick" isvisible="0"></node>
>  >  > > > > > <node activity="LOA_Sick" label="LOA" isvisible="0"></node>
>  >  > > > > > </node>
>  >  > > > > >
>  >  > > > > > and it's loaded in the model (using Cairngorm)
>  >  > > > > >
>  >  > > > > >
>  >  > > > > >
>  >  > > > > >
>  >  > > > > >
>  >  > > > > > On Wed, Apr 9, 2008 at 1:21 PM, nothsaevets
>  >  <[EMAIL PROTECTED]>
>  >
>  >
>  > > > wrote:
>  >  > > > > > > For filtering top-level elements, all you need to do is
>  >  specify a
>  >  > > > > > > filter function for the XMLListCollection which you are
>  >  using as the
>  >  > > > > > > dataprovider for the tree. It is important to call the
>  >  refresh()
>  >  > > > > > > function on the XMLListCollection after setting the
>  >  filter function.
>  >  > > > > > > Let me know if you need more code than this.
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > > <mx:Tree dataProvider="{filteredCollection}" />
>  >  > > > > > >
>  >  > > > > > > private function filterInvisibleNode(item:Object):Boolean
>  >  {
>  >  > > > > > > if( item != null && [EMAIL PROTECTED] == 'true'){
>  >  > > > > > > return true;
>  >  > > > > > > }
>  >  > > > > > > else {
>  >  > > > > > > return false;
>  >  > > > > > > }
>  >  > > > > > > }
>  >  > > > > > >
>  >  > > > > > > private function get filteredCollection
>  >  ():XMLListCollection {
>  >  > > > > > > var col:XMLListCollection = new XMLListCollection(
>  >  myxml );
>  >  > > > > > > col.filterFunction = filterInvisibleNode;
>  >  > > > > > > col.refresh();
>  >  > > > > > > return col;
>  >  > > > > > >
>  >  > > > > > > }
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > > --- In [email protected], "Greg Morphis"
>  >  <gmorphis@>
>  >  > > > > > > wrote:
>  >  > > > > > > >
>  >  > > > > > >
>  >  > > > > > > > The parent nodes are the ones I'm focusing on.
>  >  > > > > > > >
>  >  > > > > > > > On Wed, Apr 9, 2008 at 12:53 PM, nothsaevets
>  >  <steve.ashton@>
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > > wrote:
>  >  > > > > > > > > Are you trying to make the top-level nodes invisible,
>  >  or nodes
>  >  > > > > > > that
>  >  > > > > > > > > are themselves children of other nodes?
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > > --- In [email protected], "Greg Morphis"
>  >  <gmorphis@>
>  >  > > > > > > > > wrote:
>  >  > > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > > > I'm feeding an XMLList into a mx:Tree component and
>  >  want to
>  >  > > set
>  >  > > > > > > the
>  >  > > > > > > > > > visible of the parent node to false when the data
>  >  has the
>  >  > > > > > > > > isvisible=0.
>  >  > > > > > > > > > I've tried editing the <mx:Tree to show
>  >  > > > > > > visible="{data.isvisible}"
>  >  > > > > > > > > > But that didn't work.
>  >  > > > > > > > > >
>  >  > > > > > > > > > We have an itemRenderer for the Tree but all that
>  >  handles is a
>  >  > > > > > > > > > mousedown event..
>  >  > > > > > > > > > I've tried playing with that but haven't got
>  >  anywhere..
>  >  > > > > > > > > > I googled some but that wasn't much help..
>  >  > > > > > > > > >
>  >  > > > > > > > > > So if I have a tree
>  >  > > > > > > > > > <mx:Tree height="100%"
>  >  > > > > > > > > > width="100%"
>  >  > > > > > > > > > dataProvider="{ MyModel.getInstance
>  >  > > > > > > ().myXML}"
>  >  > > > > > > > > > showRoot="false"
>  >  > > > > > > > > > labelField="@label"
>  >  > > > > > > > > > borderStyle="none"
>  >  > > > > > > > > > dragEnabled="true"
>  >  > > > > > > > > > dragMoveEnabled="false"
>  >  > > > > > > > > >
>  >  > > > > > > > > itemRenderer="com.renderers.ActivityTreeRenderer"
>  >  > > > > > > > > > />
>  >  > > > > > > > > >
>  >  > > > > > > > > >
>  >  > > > > > > > > > how do I make the parent nodes invisible?
>  >  > > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > > ------------------------------------
>  >  > > > > > > > >
>  >  > > > > > > > > --
>  >  > > > > > > > > Flexcoders Mailing List
>  >  > > > > > > > > FAQ:
>  >  > > > > > >
>  >  http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>  >  > > > > > > > > Search Archives: http://www.mail-
>  >  archive.com/flexcoders%
>  >  > > > > > > 40yahoogroups.comYahoo! Groups Links
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > > >
>  >  > > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > > ------------------------------------
>  >  > > > > > >
>  >  > > > > > > --
>  >  > > > > > > Flexcoders Mailing List
>  >  > > > > > > FAQ:
>  >  > > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>  >  > > > > > > Search Archives:
>  >  > > > > http://www.mail-archive.com/flexcoders%
>  >  40yahoogroups.comYahoo! Groups
>  >  > > Links
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > >
>  >  > > > >
>  >  > > > >
>  >  > > >
>  >  > >
>  >  > >
>  >  > >
>  >  > > --
>  >  > > Douglas Knudsen
>  >  > > http://www.cubicleman.com
>  >  > > this is my signature, like it?
>  >  >
>  >
>  >
>  >
>  >  ------------------------------------
>  >
>  >  --
>  >  Flexcoders Mailing List
>  >  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>  >
>  > Search Archives: 
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>

Reply via email to