DataGrid의 행 배경색 사용자 정의
package component
{
import flash.display.Sprite;
import mx.collections.ArrayCollection;
import mx.controls.DataGrid;
public class RowColorDataGrid extends AdvancedDatagrid
{
public var rowColorFunction:Function;
override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void
{
if(rowColorFunction != null)
{
var item:Object;
if(dataIndex < dataProvider.length)
{
item = dataProvider[dataIndex];
}
if(item)
{
color = rowColorFunction(item, rowIndex, dataIndex, color);
}
}
super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
}
}
}
2) RowColorDataGrid 사용
<component:RowColorDataGrid rowColorFunction="calcRowColor"/>
3) 사용자 정의calRowColor 메서드
private function calcRowColor(item:Object, rowIndex:int,
dataIndex:int, color:uint):uint
{
var operationStatus:String=item.operationStatus;
var backgroundColor:uint=0xFFFFFF;
if(operationStatus ==OperationStatus.Added){
backgroundColor=0xa9dc84;
}else if(operationStatus == OperationStatus.Modified){
backgroundColor=0xa28cd4;
}else if(operationStatus==OperationStatus.Deleted){
backgroundColor=0xd49251;
}else if(operationStatus ==OperationStatus.Historical){
if(rowIndex%2==0){
backgroundColor=0xFFFFFF;
}else{
backgroundColor=0xE2E2E2;
}
}else{
Alert.show("operation status is not supported","Message");
}
return backgroundColor;
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
EasyUI Datagrid Datetime(EasyUI DataGrid 시간 포맷)EasyUI DataGrid 시간 포맷 방법 1: 위에서 이러한 방법은 데이터grid에서 시험하였습니다.varobj=eval('('+'{Date: new'+value+'}'+').이 말은 도망갈 수 없다! 다음 방법...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.