给flex单列加<a>链接效果 (mx:DataGridColumn mx:Advance
发布时间:2020-12-15 04:45:36 所属栏目:百科 来源:网络整理
导读:?xml version="1.0"?mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:com="com.*" mx:Script ![CDATA[ import mx.events.ListEvent; import mx.controls.Alert; import mx.collections.ArrayCollection; private var array:ArrayCollection
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:com="com.*"> <mx:Script> <![CDATA[ import mx.events.ListEvent; import mx.controls.Alert; import mx.collections.ArrayCollection; private var array:ArrayCollection = new ArrayCollection([{id:"11",userName:"张三",deptName:"信息部"},{id:"12",userName:"李四",deptName:"信息部"} ]); public function showData(event:MouseEvent):void{ Alert.show(dg.selectedItem.id + "被点击了"); // var url:String = "test.swf"; // this.openWin(url,......,screen.width,screen.height); } ]]> </mx:Script> <mx:DataGrid id="dg" width="98%" rowCount="10" dataProvider="{array}"> <mx:columns> <mx:DataGridColumn dataField="id" headerText="编 号" width="80"> <mx:itemRenderer> <mx:Component> <mx:HBox verticalAlign="middle" horizontalGap="0"> <mx:Script> <![CDATA[ import mx.controls.Label; import mx.controls.LinkButton; override public function set data(value:Object):void{ super.data = value; if(value!=null){ this.removeAllChildren(); if(value.id!=null){ if(value.isTopOrg){ var button : LinkButton = new LinkButton(); button.setStyle("textDecoration","underline"); button.setStyle("fontWeight","bold"); button.setStyle("color","red"); button.toolTip = "点击"; button.width=60; button.label=value.id.toString(); button.addEventListener(MouseEvent.CLICK,outerDocument.showData); this.addChild(button); }else{ var button : LinkButton = new LinkButton(); button.setStyle("textDecoration",outerDocument.showData); this.addChild(button); } }else{ var label:Label = new Label; label.setStyle("fontWeight","bold"); label.text = "0"; this.addChild(label); } } } ]]> </mx:Script> </mx:HBox> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> <mx:DataGridColumn dataField="userName" width="200" headerText="姓名"/> <mx:DataGridColumn dataField="deptName" headerText="部门"/> </mx:columns> </mx:DataGrid> </mx:Application> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |