Hi Jeyaraman,

This is a quick code.. hope this is what u needed.
Note that if the dataprovider is very large, it will have performance
issues. :-)

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical">
        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;

                        import mx.collections.ArrayCollection;
                        [Bindable]
                        private var testAC:ArrayCollection = new 
ArrayCollection( [
                                                        { name: "jai", 
location: "Chennai"},
                                                        { name: "anoop", 
location: "Bangalore"},
                                                        { name: "adarsh", 
location: "Mumbai"} ]);
                        private function add():void{
                                var nam:String = txtName.text;
                                var loc:String = txtLoc.text;
                                var i:int = 0;
                                for(i=0; i<testAC.length; i++){
                                        if(testAC.getItemAt(i).name == nam)
                                                break;
                                }
                                if(i == testAC.length)
                                        testAC.addItem({name:nam,location:loc});
                                else
                                        Alert.show('NOPES');
                        }
                ]]>
        </mx:Script>
        <mx:DataGrid dataProvider="{testAC}">
                <mx:columns>
                        <mx:DataGridColumn dataField="name"/>
                        <mx:DataGridColumn dataField="location"/>
                </mx:columns>
        </mx:DataGrid>
        <mx:TextInput id="txtName"/>
        <mx:TextInput id="txtLoc"/>
        <mx:Button label="OK" click="add()"/>

</mx:Application>

Just Try this and let me know...

Happy Coding...
Cheers,
Anoop PK


On Sep 22, 4:48 am, Jeyaraman <[email protected]> wrote:
> Hi Gurus,
>
> I am doing project in Flex, and i m new to flex.
>
> i want to add the datas in datagrid..i have done with tat how do add
> it....but i cant do for another level..
>  For example if i give a value in input textbox like jai and chennai of
> columns of datagrid that should show as already u have added tat jai and
> chennai..
>
> that mean how to find  already added  values. hope can anyone give me the
> solution for that..........
>
> Thanks 'N' Regards,
>
>    Jeyaraman
>
>         “Don't sit and wait  -  Look for the next opportunity.”

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to