Hi Don, Thanks for the reply.
I do am able to do the same using an in-line itemrenderer. But right now, my itemrenderer is an external AS file. So I declare my MXML like: <mx:DataGridColumn id="dgActionColumn" width="100" visible="true" itemRenderer="myButtonItemRenderer" /> Where myButtonItemRenderer is an external AS file which extends the button. Now, where I declare the datagrid, I am writing a function which I need to wire up to the itemrenderer so that on the click of the button, that method is dispatched. Thanks. ________________________________ From: fusionpage <[email protected]> To: [email protected] Sent: Tue, 17 August, 2010 8:29:11 Subject: [flexcoders] Re: Method for a Datagrid Button Itemrenderer 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 [email protected], 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: [email protected] > 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. >

