There is an example in the doc for this situation:
 
 
Stephen


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kumar
Sent: Monday, September 11, 2006 2:44 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] validators in datagrid colmun

Hi All 
 
Below is the simple data grid 
I want to apply some like numeric validators on some particular column of data grid. Is there any example for this..
 
 
 
 
!
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    
    <mx:Script>
        <![CDATA[
        
        &n!
 bsp;   import mx.controls.TextInput;
            import mx.events.DataGridEvent;
 
            [Bindable]
            public var initDG:Array = [
                {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99},
                {Artist:'Pavement', Album:'Brighten the Corners', Price:11.99}
            ];
            
               // Define event listener for the itemEditEnd event.
            private function getCellInfo(event:DataGridEvent):void!
  
            {
                
                // Get the item editor and cast it to TextInput.
                var myEditor:TextInput =  TextInput(event.currentTarget.itemEditorInstance);
            &!
 nbsp;   
                // Get the new value from the editor.
                var newVal:String = myEditor.text;
                
                // Get the old value.
  &n!
 bsp;          &nb!
 sp; 
; var oldVal:String = event.currentTarget.editedItemRenderer.data[event.dataField]; 
            
                // Write out the cell coordinates, new value, 
                // and old value to the TextArea control.
                cellInfo.text = "cell edited.\n";!
 
                cellInfo.text += "Row, column: " + event.rowIndex + ", " +  event.columnIndex + "\n";
                cellInfo.text += "New value: " + newVal + "\n";
                cellInfo.text += "Old value: " + oldVal;
            }   !
 ;           !
  &n
bsp;               
        ]]>
    </mx:Script>
 
 
 
 
    <mx:TextArea id="cellInfo" width="300" height="150&q!
 uot;/>
    
    <mx:DataGrid id="myGrid" dataProvider="{initDG}" editable="true" itemEditEnd="getCellInfo(event);">    
        <mx:columns>
            <mx:DataGridColumn dataField="Artist" />
            <mx:DataGridColumn!
  dataField="Album"/>
            <mx:DataGridColumn dataField="Price"/>
        </mx:columns>        
    </mx:DataGrid>   
    
</mx:Application>
 
&!
 nbsp;
Thanks
KP

__._,_.___

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





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to