flex List使用2

来源:互联网 发布:老马说编程 编辑:程序博客网 时间:2024/05/02 00:15
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="450" height="220">
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   import mx.collections.ArrayCollection;
   [Bindable]public var titleName:String;//标题
   [Bindable]public var canChooseList:ArrayCollection=new ArrayCollection();
   [Bindable]public var chosenList:ArrayCollection=new ArrayCollection();
   private function doChoose():void{
    if(leftList.selectedItem){
     chosenList.removeAll();
     chosenList.addItem(leftList.selectedItem);
    }else{
     Alert.show("请先选择一个处理人!","提示");
    }
   }
   private function unChoose():void{
    chosenList.removeAll();
   }
   public function validate():Boolean{
    var result:Boolean=false;
    if(chosenList!=null&&chosenList.length>0){
     result=true;
    }
    return result;
   }
   private function filteHandler():void{
    var txt:String=chooseUser.text;
    if(txt==null||txt==""){
     leftList.dataProvider=canChooseList;
    }else{
     var temp:ArrayCollection=new ArrayCollection();
     for each(var item:Object in canChooseList){
      var theName:String=item.handlerName;
      if(theName.indexOf(txt)!=-1){
       temp.addItem(item);
      }
     }
     leftList.dataProvider=temp;
    }
   }
  ]]>
 </mx:Script>
 </mx:VBox>
原创粉丝点击