Hi everyone,
i'm trying a modified docs datgrid example where i call 
event.preventDefault() first, and then do the validation (example 
below).

If the validation fails i show the errorString otherwise i want to 
continue.

How do i cancel the event.preventDefault() (if that makes sense)

regrds
bod


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>

<mx:Script>
<![CDATA[
        
  import mx.controls.TextInput;
  import mx.events.*;
            
  [Bindable]
  public var initDG:Array = [{Company: 'Acme', Contact: 'Bob Jones', 
Phone: '413-555-1212', City: 'Boston', State: 'MA'},
{Company: 'Allied', Contact: 'Jane Smith', Phone: '617-555-3434', 
City: 'SanFrancisco', State: 'CA'} ];
            
 public function validateData(event:DataGridEvent):void
 {                    
   event.preventDefault();
                
   validateMe(event);
 }
            
 public function validateMe(event:DataGridEvent):void
 {
   var newData:String= TextInput(myGrid.itemEditorInstance).text;
   if(newData == "") 
   {
    TextInput(myGrid.itemEditorInstance).errorString =  "ERROR";
   }
   else
   {
    // How do i cancel original preventDefault();
   }
 }
 ]]>
 </mx:Script>
    
 <mx:DataGrid id="myGrid" dataProvider="{initDG}" editable="true" 
itemEditEnd="validateData(event)">
    <mx:columns>
      <mx:DataGridColumn dataField="Company" editable="false"/>
      <mx:DataGridColumn dataField="Contact"/>
      <mx:DataGridColumn dataField="Phone"/>
      <mx:DataGridColumn dataField="City"/>
      <mx:DataGridColumn dataField="State"/>
     </mx:columns>
  </mx:DataGrid>
</mx:Application>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to