设置DataGrid行颜色,页面加载一直等待,高手解决,谢谢

juaby 2011-01-17 10:41:51
代买如下:我没发现什么问题,谁指点下

package com.juaby.bt
{
import flash.display.Sprite;
import mx.controls.DataGrid;

public class CustomerDataGrid extends DataGrid
{

private var _rowColorFunction:Function;

public function CustomerDataGrid()
{
super();
}

public function set rowColorFunction(rowColorFunction:Function):void
{
this._rowColorFunction = rowColorFunction;
}

public function get rowColorFunction():Function
{
return this._rowColorFunction;
}

override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void
{
if( this.rowColorFunction != null ){
if( dataIndex < this.dataProvider.length ){
var item:Object = this.dataProvider.getItemAt(dataIndex);
color = this.rowColorFunction.call(this, item, color);
}
}
super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);

}

}
}




private function setRowColorFunction(item:Object, color:uint):uint
{
if (item['money'] == "自动") //将column列值为“ ”的行颜色设置为0xbeff8e
{
return 0xbeff8e;

}
return color;
}




<bt:CustomerDataGrid x="24" y="366" width="523" id="dataGrid2" height="141" click="dataGrid2_clickHandler(event)" rowColorFunction="setRowColorFunction">
<bt:columns>
<mx:DataGridColumn headerText="流水号" dataField="no"/>
<mx:DataGridColumn headerText="金额" dataField="money"/>
</bt:columns>
</bt:CustomerDataGrid>


...全文
116 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
HelloFR 2011-01-19
  • 打赏
  • 举报
回复
接分
juaby 2011-01-17
  • 打赏
  • 举报
回复
如此之冷清,此版块该关闭了,我再等会
juaby 2011-01-17
  • 打赏
  • 举报
回复
哥们,看出啥猫腻没
jack_qdb 2011-01-17
  • 打赏
  • 举报
回复
接分来了!
juaby 2011-01-17
  • 打赏
  • 举报
回复
冷清的要命,周一都开会呢吗
juaby 2011-01-17
  • 打赏
  • 举报
回复
问题出在重写函数里,我把里边的代码注释掉一切正常。。。。

4,328

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计 Flex
社区管理员
  • Flex
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧