文章分类 Classification
Flex3.0入门课程:DataGrid实现过滤数据功能
稿件来源: 阳光企业网站管理系统 撰稿作者: 太阳光 发表日期: 2013-09-18 阅读次数: 94 查看权限: 游客查看
Flex3.0入门课程:DataGrid实现过滤数据功能
data_grid.mxml
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" fontSize="12"> <mx:Script> <![CDATA[ import mx.controls.dataGridClasses.DataGridColumn; private function toggleFilter():void{ if(checkBox.selected){ arrColl.filterFunction = processFilter; }else{ arrColl.filterFunction = null; } arrColl.refresh(); } private function processFilter(item:Object):Boolean{ return parseFloat(item.value) == 0; } //自动格式化函数 private function value_labelFunc(item:Object,col:DataGridColumn):String{ return item[col.dataField].toFixed(2); } ]]> </mx:Script> <mx:ArrayCollection id="arrColl"> <mx:source> <mx:Array> <mx:Object name="ColdFusion" value="0.00" /> <mx:Object name="Dreamweaver" value="0.12" /> <mx:Object name="fireworks" value="1.01" /> <mx:Object name="flash" value="0" /> <mx:Object name="flash player" value="0.00" /> <mx:Object name="flex" value="0.00" /> <mx:Object name="Illustrator" value="2.92" /> <mx:Object name="Lightroom" value="0.32" /> <mx:Object name="photoshop" value="0.10" /> <mx:Object name="codrew" value="0.90" /> <mx:Object name="webstor" value="9.00" /> </mx:Array> </mx:source> </mx:ArrayCollection> <mx:Panel title="实现数据过滤显示" width="360" height="240" horizontalAlign="center" status="{arrColl.length}/{arrColl.source.length} 行" > <mx:ApplicationControlBar dock="true" width="100%"> <mx:CheckBox id="checkBox" label="过滤数据(value=0)" click="toggleFilter();"/> </mx:ApplicationControlBar> <mx:DataGrid id="dataGrid" dataProvider="{arrColl}" rowCount="5" verticalScrollPolicy="on" width="300"> <mx:columns> <mx:DataGridColumn dataField="name" /> <mx:DataGridColumn dataField="value" labelFunction="value_labelFunc" /> </mx:columns> </mx:DataGrid> </mx:Panel> </mx:Application>
关键词: Flex3.0,入门课程,datagrid 编辑时间: 2013-09-18 16:34:30
0
高兴0
支持0
搞笑0
不解0
谎言0
枪稿0
震惊0
无奈0
无聊0
反对0
愤怒
0%(0)
0%(0)
- 暂无评论
文章图片 article Pictrue
网友评论