I have a functional datagrid that responds to itemClick events. Everything works, except that it also triggers the itemClick event when the headers are clicked. So instead of sorting the grid data they trigger the event which changes the state. I want to only have the click event respond to the rows being clicked, not the headers.
I have googled everywhere and dug through my books and every example i've seen seems to work, so i'm wondering what i am 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 issue here was my cache settings. I was working with a cached version that had a click event instead of an itemClick. So the click event responds to all clicks on the grid and the itemClick does as desired, all I needed to to was turn off my cache. Bonehead on my part, But thanks for the help.