destroyItemEditor

var dg:DataGrid=event.currentTarget as DataGrid;
    var editorinstance:UIComponent=dg.itemEditorInstance as UIComponent;
    var dgfieldname:String=event.dataField;
    
    if(editorinstance is mx.controls.NumericStepper){
     var o:mx.controls.NumericStepper=(editorinstance as mx.controls.NumericStepper);
     var newvalue:String=o.value.toString();
     if(newvalue=="0"||newvalue==null)
     {
      var a=event.itemRenderer.data;
      event.itemRenderer.data[dgfieldname]=NaN; 
     }
     else
     {
      event.itemRenderer.data[dgfieldname]=newvalue;
     }
     
    }
    if(editorinstance is ComboBase){
     if((editorinstance as ComboBase).selectedItem==null)
     {
      return;
     }
     var newvalue:String=(editorinstance as ComboBase).selectedItem.toString();
     event.itemRenderer.data[dgfieldname]=newvalue;
    }
    if(editorinstance is TextInput){
     var newvalue:String=(editorinstance as TextInput).text;
     event.itemRenderer.data[dgfieldname]=newvalue;
    }
    dg.destroyItemEditor();  
   

 

 

destroyItemEditor();  
是一定要关闭的,不然对itemrender会有一定的影响

 

你可能感兴趣的:(editor)