Alex:
Thanks for the reply. What I am doing is not quite an inline
component. I have 1 component in my mxml file that is referenced by
3 different datagrids like this;
<mx:Component id="cbHoldRelease">
<mx:HBox textAlign="center">
<mx:Script>
<![CDATA[
private function doHoldRelease(data:Object):void
{
trace('What datagrid called me?');
}
]]>
</mx:Script>
<inp:ValidatedCheckBox checkedValue="R" uncheckedValue="H"
click="doHoldRelease(data);"/>
</mx:HBox>
</mx:Component>
<mx:DataGrid width="887" height="20" id="dg1" y="28" x="5>
<mx:columns>
<mx:DataGridColumn width="27" headerText="Rel"
itemRenderer="{cbHoldRelease}"
rendererIsEditor="true"
editorDataField="selected" paddingLeft="1"/>
</mx:columns>
</mx:DataGrid>
<mx:DataGrid width="887" height="20" id="dg2" y="48" x="5">
<mx:columns>
<mx:DataGridColumn width="27" headerText="Rel"
itemRenderer="{cbHoldRelease}"
rendererIsEditor="true"
editorDataField="selected" paddingLeft="1"/>
</mx:columns>
</mx:DataGrid>
<mx:DataGrid width="887" height="20" id="dg3" y="68" x="5">
<mx:columns>
<mx:DataGridColumn width="27" headerText="Rel"
itemRenderer="{cbHoldRelease}"
rendererIsEditor="true"
editorDataField="selected" paddingLeft="1"/>
</mx:columns>
</mx:DataGrid>
The trace statement needs to display dg1, dg2, dg3 depending on
where the user was when they clicked the button. Actually I need to
pass the dg(1,2,3).dataprovider, and the the selectedIndex.
BTW ValidatedCheckBox is a data aware checkbox component we wrote.
--- In [email protected], Alex Harui <aha...@...> wrote:
>
> <mx:DataGrid id="dg"
> <mx:columns>
> <mx:DataGridColumn>
> <mx:itemRenderer>
>
<mx:Component>
>
From in here, outerDocument.dg is the DataGrid for this
inline renderer
>
> You can also use "owner" in most cases
>
> Alex Harui
> Flex SDK Developer
> Adobe Systems Inc.<http://www.adobe.com/>
> Blog: http://blogs.adobe.com/aharui
>
> From: [email protected]
[mailto:[email protected]] On Behalf Of aceoohay
> Sent: Sunday, February 22, 2009 1:08 PM
> To: [email protected]
> Subject: [flexcoders] properties and methods of a datagrid from
item renderer
>
>
> How do you access the properties and methods of a datagrid from an
an
> item renderer/inline component?
>
> I have a component that is called from multiple datagrids. In
certain
> cases I need to call a routine that manipulates the datagrid,
whichever
> one has the item renderer in it.
>
> I need to access the selectedIndex, and the dataprovider to pass
to the
> outerDocument routine that I call. How can you reference grid from
> whence you came?
>
> Paul
>