Hi Dheeraj , You will have to create a itemrenderer component . Just go through the following link you would understand it in a better way :
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=cellrenderer_072_28.html On Tue, Dec 23, 2008 at 2:11 AM, dheeraj <[email protected]> wrote: > > Hi, > > I have code that gets data from a RemoteObject (Java code) and > populates the DataGrid with all the rows and columns. I want to add a > column dynamically to this datagrid and place a button on each row > which would do some action for that row when clicked. > > The issue is that I am not able to create the button in the datagrid > and add the properties to it. I found something on the web which I > have used, but it creates only a button on each row. How can I add the > icon and mouse click event listener to each button in the grid. > > Here is the code to generate the buttons for each record in the > DataGrid. > > var cols:Array = dataGrid.columns; > var dgc:DataGridColumn = new DataGridColumn(); > dgc.headerText = "Comments"; > > var classToUse:String = "mx.controls.LinkButton"; > var classRef:Class = getDefinitionByName(classToUse) as Class; > var factory:ClassFactory = new ClassFactory(classRef); > > dgc.itemRenderer = factory; > cols.push(dgc); > dataGrid.columns = cols; > > Any help with this issue will be appreciated. > > Regards, > Dheeraj > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

