itemEditEnd event on datagrid

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

itemEditEnd event on datagrid

Robert Moss
in the following code, which I copied out of the livedocs and modified
to throw an alert when the itemEditEnd event is fired, it seems that
every time the cell you are editing loses focus, the event gets kicked
off 5 times, the first 4 times with a reason of "other" and the last
with "new_column".  What am I missing.  I'm trying to kick off code when
a cell is changed, but I do not want it to run 5 times.  Thanks.
 
Robert
 
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:local="*">
 
    <mx:Script>
        <![CDATA[
       
            import mx.controls.TextInput;
            import mx.events.DataGridEvent;
            import mx.controls.Alert;
            import mx.utils.ObjectUtil;
           
            private 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    
       {                    
               Alert.show(ObjectUtil.toString(event.reason));
            }                        
        ]]>
    </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>



** Confidentiality Notice: This e-mail and any files transmitted with it are confidential to the extent permitted by law and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the originator of the message and destroy all copies. **