Response to ItemClick events in rows, not headers
I have a functional datagrid that responds to itemClick events. Everything works except that it also fires the itemClick event when the headers are clicked. So instead of sorting the grid data, they fire an event that changes state. I want the click event to respond to the rows pressed, not the headers.
I've googled all over the place and dug my books and every example I've seen seems to work, so I'm wondering what I'm doing wrong here:
<mx:Script>
<![CDATA[
[Bindable]
public var acPrograms:ArrayCollection;
private function showGameDetail(event:ListEvent):void {
var programEvent:ProgramsEvent = new ProgramsEvent(ProgramsEvent.SHOW_DETAIL);
programEvent.selectedProgram = TvPrograms( event.currentTarget.selectedItem );
dispatchEvent(programEvent);
currentState = "details";
}
]]>
</mx:Script>
<mx:DataGrid id="gamesGrid" height="270" dataProvider="{acPrograms}"
itemClick="showGameDetail(event);">
<mx:columns>
<mx:DataGridColumn headerText="Date" dataField="dateOutput" width="90" />
<mx:DataGridColumn headerText="Time" dataField="startTime" width="70" />
<mx:DataGridColumn headerText="Title" dataField="subTitle" width="360" />
<mx:DataGridColumn headerText="Channel" dataField="channel" width="80" />
<mx:DataGridColumn headerText="Provider" dataField="provider" width="100" />
</mx:columns>
</mx:DataGrid>
Edit:
The real problem here was the cache settings. I was working with a cached version that had a click event instead of itemClick. This way, the click event responds to all clicks on the grid and itemClick does all it needs, all I need to do is disable my cache. Bonehead for my part, but thanks for the help.
0
a source to share