I typically use code like this to call a method in the parent MXML page that 
contains the dataGrid...

<mx:AdvancedDataGridColumn width="80" headerText="Launch" 
dataField="contentURL">
                                                        <mx:itemRenderer>
                                                                <mx:Component>
                                                                        
<mx:Button label="Launch" click="parentDocument.goDownload();"/>
                                                                </mx:Component>
                                                        </mx:itemRenderer>
                                                </mx:AdvancedDataGridColumn>

Don

--- In flexcoders@yahoogroups.com, Angelo Anolin <angelo_ano...@...> wrote:
>
> I know someone has encountered this before. 
> 
> Better to rephrase this one I guess.
> 
> I have an MXML file, where I have a method.  In that MXML file, I have a 
> datagrid, where one of the columns, I created an external itemrenderer.  The 
> itemrenderer is a button.  When I click that button, I want that button to 
> call 
> the method in the MXML file (so that I could re-use the button on other 
> datagrids).  
> 
> Thanks.
> 
> 
> 
> ________________________________
> From: Angelo Anolin <angelo_ano...@...>
> To: flexcoders@yahoogroups.com
> Sent: Mon, 16 August, 2010 13:54:33
> Subject: [flexcoders] Method for a Datagrid Button Itemrenderer
> 
>   
> Hi Flexcoders,
> 
> I have a datagrid and an button itemrenderer named btnRenderer.as
> 
> I have set this button as an itemRenderer in one of my datagrid columns.
> 
> <mx:DataGridColumn id="dgColCancel" width="100" itemRenderer="btnRenderer" />
> 
> I need to respond to an click event on button, passing some of the value from 
> the dataProvider attached to the datagrid.
> 
> Should I place my codes on the mxml file where my datagrid is declared?  How 
> would the btnRenderer know that the method is called?
> 
> Thanks.
>


Reply via email to