DataGrid 小结

本文主要总结了DataGrid在数据显示方面的应用,包括不同效果的实现,如数据分页、排序和过滤等,探讨了其在提升数据展示效率和用户体验上的重要作用。
摘要由CSDN通过智能技术生成
隔行换色------------------------------------------------------------------------------------------

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>

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值