<mx:itemRenderer>使用
2011-08-31 11:45
447 查看
<mx:itemRenderer>标签中的要素时间调用外部要素 :代码红色部分
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Embed(source='assets/myimages/gl.png')] [Bindable] public var ssjcgl:Class; [Bindable] private var dp:ArrayCollection=new ArrayCollection ([{name:'张村监测站',sw:36,no:1,level:"警戒"}, {name:'王村监测站',sw:20,no:1,level:"危险"}) //注意调用的方法是public的 public function clickEvent(o:Object):void{ log.debug(o); } public function test(o:Object):void{ log.debug(o); } public function test2(o:Object):void{ log.debug(o); } ]]> </mx:Script> <mx:VBox width="100%" height="100%" horizontalAlign="center"> <mx:DataGrid width="400" height="500" dataProvider="{dp}"> <mx:columns> <mx:DataGridColumn headerText="站名"> <mx:itemRenderer> <mx:Component> <mx:LinkButton label="{data.name}" textDecoration="underline" click="outerDocument.clickEvent(data)"> </mx:LinkButton> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> <mx:DataGridColumn headerText="雨量" dataField="sw"> </mx:DataGridColumn> <mx:DataGridColumn headerText="预警级别" dataField="level"> </mx:DataGridColumn> <mx:DataGridColumn headerText="关联信息"> <mx:itemRenderer> <fx:Component> <mx:HBox horizontalAlign="center"> <mx:Image source="{outerDocument.ssjcgl}" click="outerDocument.test1(data.no)" toolTip="乡镇" buttonMode="true" useHandCursor="true" / <mx:Image source="{outerDocument.ssjcgl}" click="outerDocument.test2(data.no)" toolTip="小流域" buttonMode="true" useHandCursor="true" /> </mx:HBox> </fx:Component> </mx:itemRenderer> </mx:DataGridColumn> </mx:columns> </mx:DataGrid> </mx:VBox> </mx:Application> <mx:Image source="{outerDocument.ssjcgl}" click="outerDocument.test1(data.no)" toolTip="乡镇" buttonMode="true" useHandCursor="true" / <mx:Image source="{outerDocument.ssjcgl}" click="outerDocument.test2(data.no)" toolTip="小流域" buttonMode="true" 必须放在一个容器中否则会出错。
相关文章推荐
- Flex使用<mx:Tree>控件创建树(可添加和删除节点)
- Flex使用<mx:Tree>控件创建树(可添加和删除节点)
- <frameset>使用注意以及页面输入乱码解决
- html中<li></li>中使用<br>和<li></li>外面使用<br>
- 在Struts的jsp中使用<s: set> 和 Jstl的<c: set>
- 使用<a href="../answer/StuAnswer.jsp?Sid=<%=Sid %>&Eid=1">shuxue</a> 注意
- <<Sybase ASE in Action全程实践>>之一: 第2章 License的使用
- JSP标签的<jsp:useBean>和<jsp:setProperty><jsp:getProperty>的使用
- "<item> tag requires a 'drawable' attribute"-selector设置颜色不成功-解决方案
- <转>virsh使用qemu+tcp访问远程libvirtd
- jsp使用<c:choose>标签
- JSP中使用哪个标签允许向<include/>标签传递参数
- <context:component-scan>使用说明
- sp使用<c:choose>标签来控制内容显示
- android_应用开发之(使用<include>标签重用布局)
- UITableView使用<2>UITableViewCell的介绍
- 使用<<jquery+html5+css>>实现的20个酷的视觉大背景网站设计
- <PY><OOP>PyQt和QtDesigner混合使用(一)伯努利试验
- <s:url>标签的使用
- <s:hidden>标签的使用