`
javasogo
  • 浏览: 1775513 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Flex 使用ArrayCollection的FilterFunction进行数据过滤

阅读更多

<?xmlversion="1.0"encoding="utf-8"?> <mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"fontFamily="simsun"fontSize="12" creationComplete="hs.send()"> <mx:Script> <![CDATA[ importmx.collections.ArrayCollection; importmx.rpc.events.*; importmx.controls.Alert; privatefunctionhsFault(event:FaultEvent):void{ Alert.show(event.message.toString(),"Error"); } privatefunctionhsResult(event:ResultEvent):void{ mydata=event.result.NewDataSet.TableasArrayCollection; mydata.filterFunction=NameFilterChanged; mydata.refresh(); } publicfunctionNameFilterChanged(item:Object):Boolean{ varname:String=item.姓名; varsno:String=item.学号; varsex:String=item.性别; if(cmbSex.selectedItem.data!="全部") return(sno.indexOf(txtSNO.text,0)>=0)&&(name.indexOf(txtName.text,0)>=0)&&(cmbSex.selectedItem.data==sex); else return(sno.indexOf(txtSNO.text,0)>=0)&&(name.indexOf(txtName.text,0)>=0); } [Bindable] privatevarmydata:ArrayCollection; ]]> </mx:Script> <mx:HTTPServiceid="hs"useProxy="false"url="绿色通道名单.xml"fault="hsFault(event)" showBusyCursor="true"result="hsResult(event)"/> <mx:DataGriddataProvider="{mydata}"right="10"left="9"top="38"bottom="20"> <mx:columns> <mx:DataGridColumnheaderText="姓名"dataField="姓名"/> <mx:DataGridColumnheaderText="性别"dataField="性别"/> <mx:DataGridColumnheaderText="学号"dataField="学号"/> <mx:DataGridColumnheaderText="准考证号"dataField="准考证号"/> <mx:DataGridColumnheaderText="生源地"dataField="生源地"/> <mx:DataGridColumnheaderText="身份"dataField="身份"/> <mx:DataGridColumnheaderText="户口"dataField="户口"/> <mx:DataGridColumnheaderText="部门"dataField="部门"/> <mx:DataGridColumnheaderText="原因"dataField="原因"/> <mx:DataGridColumnheaderText="财务处是否办理"dataField="财务处是否办理"/> </mx:columns> </mx:DataGrid> <mx:Labelx="186"y="12"text="姓名:"/> <mx:TextInputid="txtName"x="229"y="10"change="{mydata.refresh()}"width="95"/> <mx:ComboBoxx="391"y="10"width="94"id="cmbSex"labelField="title"change="mydata.refresh()"> <mx:dataProvider> <mx:Array> <mx:Objecttitle="全部"data="全部"/> <mx:Objecttitle="男"data="男"/> <mx:Objecttitle="女"data="女"/> </mx:Array> </mx:dataProvider> </mx:ComboBox> <mx:Labelx="348"y="12"text="性别:"/> <mx:TextInputx="76"y="10"width="102"id="txtSNO"change="{mydata.refresh()}"/> <mx:Labelx="33"y="12"text="学号:"/> </mx:Application>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics