简体   繁体   English

更改DataGrid Cell Flex 4.6的背景颜色

[英]Change Background Color of DataGrid Cell Flex 4.6

I am trying to change the background color of my datagrid. 我正在尝试更改数据网格的背景颜色。 I have the following which does change the color to red.... but only after I have clicked on the grid. 我有以下将颜色更改为红色的方法。...但是仅在单击网格之后。 I need the background color to start as red. 我需要背景颜色从红色开始。

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
            {
                super.updateDisplayList(unscaledWidth, unscaledHeight);
                var g:Graphics = graphics;
                g.clear();

                if (this.column.dataField == "data1")
                {

                    g.beginFill(0xFF0000);
                    g.drawRect(0, 0, unscaledWidth, unscaledHeight);
                    g.endFill();
                }
            }

This is inside my custom ItemRenderer 这是在我的自定义ItemRenderer中

Try call invalidateDisplayList function. 尝试调用invalidateDisplayList函数。

override public function prepare(hasBeenRecycled:Boolean):void {
      //do stuff

     this.invalidateDisplayList();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM