8/4/2010 5:55:35 AM
Title:
Get parent component of the itemrenderer
Hi
I'm reusing the custom itemrenderer component.
<mx:List id="todolist" width="100%" height="100%" dataProvider="{todoColl}" labelField="todo" itemRenderer="Customchecklist"/>
<mx:List id="donelist" width="100%" height="100%" dataProvider="{todoColl}" labelField="todo" itemRenderer="Customchecklist"/>
I'm trying to get the id of the list inside the itemrenderer, which list the itemrenderer is rendered .
Thanks in Advance.
Senling
Shawn
Points: 680
Posts:0
8/4/2010 6:53:53 AM
In the itemRenderer use "parent.parent.name" this should work for a tileList you can go up and down by adding or removing more parents to reach the exact parent .
you can trace this on the initialize event of the renderer
protected function renderer_initializeHandler(event:FlexEvent):void
{
// to see all levels of containers trace this
trace(this)
//the list should be around 2 leves back
trace(parent.parent.name)
}
8/4/2010 6:59:45 AM
Yes it worked perfectly.
I tried all the possibilities of parent.parent, owner.document etc..,
parent.parent.name worked perfectly, this is what i need..
Many thanks
Senling.