从commitProperties()可以看出
if (dataTips){
if (label.textWidth > label.width || column.dataTipFunction || column.dataTipField || grid.dataTipFunction || grid.dataTipField) {
toolTip = column.itemToDataTip(_data);
} else {
toolTip = null;
}
} else {
toolTip = null;
}
}
所以直接设置我们需要的toolTip就可以了
public class CustomHeaderRenderer extends AdvancedDataGridHeaderRenderer{
public function CustomHeaderRenderer(){
super();
}
override public function commitProperties():void {
super.commitProperties();
if (this.listData){
//从render中找dataField BaseListData(label:String, uid:String, owner:IUIComponent, rowIndex:int = 0, columnIndex:int = 0)
var dg:AdvancedDataGrid = AdvancedDataGrid(this.listData.owner);
var column:AdvancedDataGridColumn =dg.columns[this.listData.columnIndex];
toolTip=column.dataField;
}
}
}
在column里加上headerRenderer="Renderer.CustomHeaderRenderer"就可以了
记得extends AdvancedDataGridHeaderRenderer,而不是AdvancedDataGridItemRenderer,不然默认的排序图标就没有了
我以前用了AdvancedDataGridItemRenderer,调了老半天,默认的排序图标就是不出来。
默认的排序图标
arr.sort = new Sort();
arr.sort.fields = [new SortField("Total", false, false),new SortField("Call", false, false)];
arr.refresh();
更改排序图标:
sortItemRenderer="VenomSortIconRenderer"
override protected function createChildren():void{
super.createChildren();
var icon:DisplayObject = getChildByName("sortIcon");
if (icon == null) {
sortIcon = arrowDown ? _descendingIcon : _ascendingIcon;
icon = DisplayObject(new sortIcon());
icon.name = "sortIcon";
addChild(icon);
}
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth,unscaledHeight);
if (unscaledWidth == 0) return;
var icon:DisplayObject = getChildByName("sortIcon");
if (icon) {
icon.x = unscaledWidth - icon.width;
icon.y = 0;
}
}
分组功能
var gc:GroupingCollection = new GroupingCollection();
var myGrouping:Grouping = new Grouping();
myGrouping.fields = [new GroupingField("OrgName"),new GroupingField("Department")];
gc.source = collegeAC;
gc.grouping = myGrouping;
gc.refresh();
var adgGroup:AdvancedDataGridColumnGroup = new AdvancedDataGridColumnGroup();
adgGroup.headerText = "Branch";
adgGroup.children = [col2,col4];
adg.groupedColumns = [col1,adgGroup,col3,col5];
更改背景
this.background = true;
this.backgroundColor = 0xCC0000;
showDataTips="true"
dataTipFunction="columnChart_dataTipFunc"
public function columnChart_dataTipFunc(item:HitData):String {
var cSI:ColumnSeriesItem = item.chartItem as ColumnSeriesItem;
var el:ColumnSeries=item.element as ColumnSeries;
var cc:ColumnChart=el.owner as ColumnChart;
var ch:CategoryAxis=cc.horizontalAxis as CategoryAxis;
return StringUtil.substitute("<b>{0}</b><br>{1}",cSI.item[ch.categoryField],cSI.item[el.yField]);
}
.