If I open all the nodes in the tree, i.e. make them visible though and then try to get a handle to one of the custom item renderers I'm getting that it is null, i.e. itemRenderer in code below is always null.
for each (var model:String in _carModels) { for each (var item:XML in dp..node) { if ([EMAIL PROTECTED] == model) { trace("model="+model); trace("[EMAIL PROTECTED]"[EMAIL PROTECTED]); var itemRenderer:CheckTreeRenderer = tree.itemToItemRenderer (item) as CheckTreeRenderer; trace("itemRenderer="+itemRenderer); itemRenderer.select(); } } } --- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > It sounds like you may not understand that item renderers are recycled, > and do not even exist when non-visible. > > > > What exactly do you mean by "initialize" the item renderer? They are > components, and live the normal component lifecycle, including > initialize and creationComplete events. "initialization" that is not > dependent on the item node data can be done in handlers for those > events. > > > > Any properties or behaviors that are dependent on the item node data > must be manipulated through the set data, commitProperties, > updateDisplayList and invalidation mechanisms. > > > > My bet is a "customer" checkbox IS dependent on the underlying data. It > must get its value from the data and user interaction must be persisted > in the data. > > > > If you already know all this sorry, I may be misunderstanding your > question, otherwise I suggest that you find an existing item renderer to > use as an example. There will be many available. Google Alex Harui > itemRenderer. > > > > Tracy > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of paulbohnenkamp > Sent: Tuesday, September 09, 2008 12:31 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] tree component and null itemRenderer > > > > I've got a tree component with an customer checkbox itemRenderer and on > init of the outer component I need all the itemRenderers to be > initialized so I can call a method on the itemRenderer to select them > based on the result of a web service call. Is there a way to do this? > Somehow loop through the items in the tree dataprovider and select them > all so the itemRenderers are all initialized? > > I tried tree.openItems and looping through and doing tree.expandItem > (item, true) but that doesn't seem to init the itemRenderers. >