View Full Version : how to get header text of AdvancedDataGridColumnGroup on click?
Pratap
05-22-2008, 06:24 AM
Hi
am using AdvancedDataGrid to present data..
Here am facing some problem with AdvancedDataGridColumnGroup..
Requirement is something like onclick of AdvancedDataGridColumnGroup i need to populate its headerText. I used Header_Release event to do this..
but am unable to get headerText of that columnGroup..
any idea how to get header text of AdvancedDataGridColumnGroup on click?
Thanks in Advance
Pratap
kifah
05-22-2008, 10:42 AM
hi,
you can use this code to get the columns headerText,
but actually:this is working if only the all columns width are equaled.
if each column group have different width so you need to optimize the code.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.events.MoveEvent;
import mx.controls.Alert;
private function clickHandler(e:MouseEvent):void
{
var calc:Number=Math.floor(e.currentTarget.mouseX/adg.columns[0].width);
Alert.show(adg.columns[calc].headerText+"");
}
]]>
</mx:Script>
<mx:AdvancedDataGrid x="135" y="93" id="adg" designViewDataType="tree" click="{clickHandler(event);}">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="Column 1" dataField="col1" width="100"/>
<mx:AdvancedDataGridColumn headerText="Column 2" dataField="col2" width="100"/>
<mx:AdvancedDataGridColumn headerText="Column 3" dataField="col3" width="100"/>
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Application>
Best regards,
Kifah
kahuja
05-23-2008, 01:57 PM
Thats odd, if you are listening to DataGridEvent.HEADER_RELEASE then you should get the handle to the target and all its properties.
I have another idea - you can write your own header renderer and pass that to the grid. That way you can code "Click" to do whatever you want it to do.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.