asawilliams
asawilliams

Reputation: 2938

Flex DataGrid Remove Header MouseOver Highlighting

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

Upvotes: 1

Views: 3847

Answers (4)

Noon
Noon

Reputation: 21

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

Upvotes: 2

Marius G.
Marius G.

Reputation: 26

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.

Upvotes: 1

seismael
seismael

Reputation: 227

dont forget to add this import at MyDataGrid file

import mx.core.mx_internal;

works perfectly thanks.

Upvotes: 0

invertedSpear
invertedSpear

Reputation: 11054

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.

Upvotes: 0

Related Questions