我想删除在DataGrid的标题上发生鼠标悬停时出现的突出显示。
如果您不需要在该列上进行排序,则将sortable设置为false,并且鼠标悬停时不会突出显示。
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.
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.
dont forget to add this import at MyDataGrid file
import mx.core.mx_internal;
works perfectly thanks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.