Flex DataGrid and Buttons in Rows
So you’re working in Flex, and you’ve got a DataGrid. The grid’s showing some data you’ve bound it to, and you want to have a button in a row that, when you click it, does something to one of the properties of the row.
Easy. In the click event for your button, the ‘data’ property is the current row. Here’s a button that sets the lastDone property of the row to the current date:
1 2 3 4 5 6 7 8 9 10 | <mx:DataGridColumn editable="false"> <mx:itemRenderer> <mx:Component> <mx:VBox> <mx:Button label="Done Today" click="<strong>data.lastDone = new Date();</strong>"/> </mx:VBox> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> |
This gives me a column with a button in it, whose click event sets the lastDone property of the current row to the current date. No extra code anywhere else; that’s all there is to it.
May 30th, 2008 at 9:05 am
you stupid asshole look at the posted code!!! Whata fuck’a is dat?
May 30th, 2008 at 8:14 pm
Oops. Fixed it.
June 10th, 2009 at 2:43 pm
Curios what was the code earlier?
October 15th, 2009 at 11:42 pm
And… why does Hammet need to be such an ass?
Stevex: Thanks ton’s it worked like a charm.
Bob
October 29th, 2009 at 10:08 am
@Bob It takes all kinds! @stevex Thanks!
March 15th, 2010 at 10:30 pm
this does not work for me i grabbed your code dumped it on a flex page and i get a blank page?…