This content has been marked as final. Show 7 replies
Use the itemFocusIn DataGridEvent:
The event you want on the datagrid is "itemClick". You can get the index of the column from the event variable. Then you can use "dispatchEvent" to fire an event on that button.
Something like this (very watered down):
<mx:DataGrid itemClick="clicked(event)" ...
<mx:Button id="btn" click="buttonClick(event)" ....
then your as code would be:
public function clicked(e:ListEvent):void
var colIndex:int = e.columnIndex;
//trigger click on button
public function buttonClick(e:MouseEvent):void
//whatever you want to do here
Also, "itemClick" will ONLY work when you click on a cell, if you want it to work when you click on a header, use "headerRelease"
i want the event to fire if the user clicks only in column 0 of the datagrid
Yuo will have to perform that logic in the event handler.
I added the code to handle the clicking in only the first column, however when doing so, it seems to not allow the event to fire at all. Currently the code works with double-clicking anywhere on the grid. I have an id on the first column and if i use that instead of the dg, it doesn't work as i think it should.