隔行换色------------------------------------------------------------------------------------------
1.
<mx:DataGrid id="dataGrid"
dataProvider="{Font.enumerateFonts(true)}"
alternatingItemColors="[0x0000FF,0x00FF00,0xFF0000]"
horizontalCenter="0" verticalCenter="0" />
2.
s|DataGrid {
alternatingRowColors:"#FFFFFF","#D9EBF5";
}
根据数据显示不同效果--------------------------------------------------------------------
1.
<mx:Script>
<![CDATA[
import mx.formatters.DateFormatter;
override public function set data(value:Object):void{
super.data = value;
if(value.cargo_simp == "鎬昏"){
this.setStyle("color","blue");
this.setStyle("fontSize","14");
} else {
setStyle("color","black");
this.setStyle("fontSize","12");
}
}
]]>
</mx:Script>
2.
<s:DataGrid id="myWorkPlanDG" width="100%" height="100%"
dataProvider="{MyWorkPlan_Model.getInstance().workPlans}">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="plan.title" headerText="计划名称"/>
<s:GridColumn dataField="plan.content" headerText="计划内容"
labelFunction="planContentChange"/>
<s:GridColumn width="100" dataField="operation" headerText="操作">
<s:itemRenderer>
<fx:Component>
<s:GridItemRenderer>
<fx:Script>
<![CDATA[
/**删除按钮*/
private function deleteMyPlan(event:MouseEvent):void {
Alert.show("确定删除该工作计划?", "提示:", Alert.YES|Alert.NO, null, handler);
}
private function handler(event:CloseEvent):void {
if(event.detail == Alert.YES) {
var planImpl:Plan_Impl = new Plan_Impl();
var workPlan:PlanForList_Vo = super.data as PlanForList_Vo;
planImpl.deletePlan(workPlan.plan);
planImpl.addEventListener(ExchangeResultEvent.RESULT, function (event:ExchangeResultEvent):void {
if(event.result == 0) {
MyWorkPlan_Model.getInstance().workPlans.removeItem(workPlan);
} else {
Alert.show("删除失败!","提示:");
}
});
}
}
private function deleteBtnState(pl:PlanForList_Vo):Boolean
{
if(pl.plan.pid == 4) {
if(pl.callon.isfinish == 1) {
return false;
}
}
return true;
}
]]>
</fx:Script>
<mx:LinkButton id="deleteBtn" width="45" height="100%"
label="删除" click="deleteMyPlan(event)"
color="#0000FF" enabled="{deleteBtnState(data as PlanForList_Vo)}"
textDecoration="underline"/>
</s:GridItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>