flex reset Grid

/***
   * 重置 Grid
   */ 
  public static function resetClick(event:Event,grid:Grid):void{
   var rows:int = grid.numChildren;
   for(var i:int=0;i<rows;i++){
    var disp:GridRow = grid.getChildAt(i) as GridRow;
    if(disp){
     var arr:Array = disp.getChildren();
     for each(var items:GridItem in arr){
      var objs:Array = items.getChildren();
      for each(var item:DisplayObject in objs){
       if(item && item is ComboBox){
        (item as ComboBox).text = "";
        (item as ComboBox).selectedIndex = -1;
       }
       if(item && item is TextInput){
        (item as TextInput).text = "";
       }
       if(item && item is DateField){
        (item as DateField).text = "";
       }
       if(item && item is NumericStepper){
        (item as NumericStepper).value = 0;
       }
       if(item && item is TextArea){
        (item as TextArea).text = "";
       }
      }
     }
    }
   }
   
  }

上一篇:从下拉列表中选择一项时,更改组合框的文本字段?


下一篇:c#-禁用WPF组合框的下拉菜单