是否可以将渲染器用于高级数据网格中的树列并仍然保持层次结构功能?如果我使用渲染器提供程序,则会丢失树下拉列表的箭头。我想保留树功能并更改列的显示。(而不仅仅是文件夹图像)
<mx:AdvancedDataGridRendererProvider column="{titleCol}" depth="1"
renderer="com.something.titleColumnRenderer"/>
titleColumnRenderer:
<mx:VBox width="100%" xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Label id="titleLabel" textAlign="center" text="sometext" width="100"/></mx:VBox>
答案 0 :(得分:10)
以下是我为实现这一目标所做的工作:
以下是您的新课程的样子
public class CustomGroupRenderer extends AdvancedDataGridGroupItemRenderer
{
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
var listData:AdvancedDataGridListData = listData as AdvancedDataGridListData;
var advancedDataGrid:AdvancedDataGridDataGrid = listData.owner as AdvancedDataGrid;
var cellBackgroundColor:uint = 0xFF0000;
var g:Graphics = graphics;
g.clear();
if (!advancedDataGrid.isItemSelected(data) && !advancedDataGrid.isItemHighlighted(data))
{
g.beginFill(cellBackgroundColor);
g.drawRect(0, 0, unscaledWidth, unscaledHeight);
g.endFill();
}
}
}
然后将此类分配给AdvancedDataGrid的groupItemRenderer属性:
<mx:AdvancedDataGrid groupItemRenderer="com.whereever.CustomGroupRenderer"/>
或者,在ActionScript中:
myAdvancedDataGrid.groupItemRenderer = new ClassFactory(com.whereever.CustomGroupRenderer);