Flex利用Datagrid来设置全选和单选
1,效果预览图: 2,设置一个状态位,用于checkbox的选择的,从后台获取的对象集合ArrayCollection。假如其对象为Expert,有属性mainid,tname,major,depart!有两个方法设置状态位。 2.1 在后台给expert对象增加一个属性,譬如selected,类型为boolean,这样前台设置checkbox的列就可以用这个字段了 2.2 在前台处理 ?protected function getallApp_result(event:ResultEvent):void 这里就是在前台中加一个字段来设置 3,设置一个全局变量,来用于对标题栏上的checkbox做为状态位处理。 [Bindable] <mx:DataGrid id="appdg" styleName="DataGrid" width="766" height="90%" ???????? dataProvider="{allapplist}" ???????? horizontalScrollPolicy="on" headerStyleName="myHeaderStyles" color="#393939" x="74"> ??????<mx:columns> ???????<mx:DataGridColumn headerText="选择"? width="40" sortable="false"> ????????<mx:headerRenderer> ?????????<fx:Component> ??????????<mx:VBox horizontalAlign="center"> ???????????<mx:CheckBox selected="{outerDocument.allSelectCheck}" ?????????????? click="outerDocument.selectAll(this)" /> ??????????</mx:VBox> ?????????</fx:Component> ????????</mx:headerRenderer> ???????? ????????<mx:itemRenderer> ?????????<fx:Component> ??????????<mx:HBox horizontalAlign="center"> ???????????<mx:CheckBox selected="{data.selected}" ?????????????? click="data.selected =!data.selected"/> ??????????</mx:HBox> ?????????</fx:Component> ????????</mx:itemRenderer> ???????</mx:DataGridColumn> ???????<mx:DataGridColumn headerText="项目编号" dataField="appid" width="150"/> ???????<mx:DataGridColumn headerText="项目名称" dataField="appname" width="200"/> ???????<mx:DataGridColumn headerText="申请人" dataField="apppeople" width="80"/> ???????<mx:DataGridColumn headerText="申请类别" dataField="apptype" width="150"/> ??????</mx:columns>???? ?????</mx:DataGrid> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- ruby-on-rails – 将Grunt集成到Rails资产管道中
- TypedArray和attrs.xml
- 配置文件里面的xsd的基本解释
- Binary XML file line #10: Error inflating cla
- c – 选择单元格时,更改QTableView中图标的颜色突
- Saying Yes to NoSQL; Going Steady with Cassan
- 【Oracle 11g】ORA-01555: snapshot too old(快照
- cocos2dx-js 初探 整体流程helloworld.html分析
- ruby-on-rails – FactoryGirl:如何在不传递参数
- cocos2d-x-2.2 window下配置笔记(ADT+android-nd