I have to access the column field property of an advance datagrid in the header renderer. Basically what i am trying to achieve is that whenever i click on a column header field then its corresponding column field can be fetched like an alert for example.
Below is my advanced datagrid grouped columns code:-
<mx:groupedColumns>
<mx:AdvancedDataGridColumn dataField="Category" sortable="false" headerWordWrap="true" wordWrap="true" width="150"/>
<mx:AdvancedDataGridColumnGroup id="dgSampleGridGroup" headerText="Student" fontFamily="Arial" backgroundColor="0xd7e9f8" childrenDragEnabled="false">
<mx:AdvancedDataGridColumn dataField="Name" sortable="false" headerWordWrap="true" wordWrap="true" headerRenderer="customHeaderRenderer"/>
<mx:AdvancedDataGridColumn dataField="Branch" sortable="false" headerWordWrap="true" wordWrap="true"/>
<mx:AdvancedDataGridColumn dataField="RollNumber" sortable="false" wordWrap="true"/>
</mx:AdvancedDataGridColumnGroup>
</mx:groupedColumns>
Below is the header renderer that i have used:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import flash.net.navigateToURL;
import mx.controls.Alert;
override public function set data( value:Object ) : void {
super.data = value;
}
protected function linkbutton1_clickHandler(event:MouseEvent):void
{
Alert.show("Column 1:Student Name");
Alert.show("Group Header",this.parentDocument.groupHeader);
}
]]>
</mx:Script>
<mx:LinkButton label="Student Name" click="linkbutton1_clickHandler(event)" width="50"/>
</mx:HBox>
Here i have simply hardcoded the alert with the column header name. I want to fetch the column header field so that i can reuse the header renderer for all the columns. Please help me.