tags:

views:

584

answers:

4

I want to remove the highlight that occurs when mouse over occurs on the headers of a DataGrid.

A: 

This might help you:

http://jcraane.blogspot.com/2009/10/flex-how-to-create-different-rollover.html

Basically what I've found is that you can't just change it. It requires extending the header class and a whole bunch of other stuff I don't know how to do yet.

invertedSpear
A: 

if you don't need sorting on that column, just set sortable to false, and it won't get highlighted on mouse over.

Noon
A: 

Hello

Maybe the following hack will help someone. I simply wanted to remove the rollover and selection from datagrid header (flex 3).

What I made:

1) Create a new subclass of DataGridHeader and override drawHeaderIndicator and drawSelectionIndicator

package { import flash.display.Sprite;

import mx.controls.dataGridClasses.DataGridHeader; import mx.controls.listClasses.IListItemRenderer;

public class MyDataGridHeader extends DataGridHeader { public function MyDataGridHeader() { super(); }

override protected function drawHeaderIndicator(indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void {

}

override protected function drawSelectionIndicator(indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void {

} } }

2) Create a new subclass of DataGrid - lets say MyDataGrid and in constructor do the following:

public function MyDataGrid() { super(); this.mx_internal::headerClass = MyDataGridHeader; .... }

This will force DataGrid to use your DataGridHeader.

Marius G.
thanks for the answer, can you format your answer for the code portions ?
asawilliams
Be sure to import the proper classes and include the namespace or the code above won't compile. import mx.core.mx_internal; use namespace mx_internal;
Bryan Clover
A: 

dont forget to add this import at MyDataGrid file

import mx.core.mx_internal;

works perfectly thanks.

seismael