I am new to Flex and am having a hell of a time figuring out how to use the addItem method to add data to a DataGrid. I hope someone can give me a pointer. Here is what I am trying to do:
I have defined two models: one with static content and one that is bound to text input fields that are inside of a panel. When the button is pressed, I want to add the entered data to the samplegrid DataGrid. So far it looks like it is adding *something* to the DataGrid since I can see the scrollbars appear but nothing shows up in the grid itself. What am I doing wrong? <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"> <mx:Script> <![CDATA[ public function makethechange():Void { samplegrid.addItem(newmodel); } ]]> </mx:Script> <mx:Model id="newmodel"> <annotation> <name>{text1.text}</name> <time>{text2.text}</time> <comment>{text3.text}</comment> </annotation> </mx:Model> <mx:Model id="mymodel"> <annotation> <name>My Name</name> <time>My Time</time> <comment>This is my comment</comment> </annotation> <annotation> <name>My Name</name> <time>My Time</time> <comment>This is my comment</comment> </annotation> <annotation> <name>My Name</name> <time>My Time</time> <comment>This is my comment</comment> </annotation> </mx:Model> <mx:HBox> <mx:Panel width="300" title="Test Grid"> <mx:DataGrid id="samplegrid" width="100%" height="100%" dataProvider="{ mymodel.annotation }"/> </mx:Panel> <mx:Panel width="300" title="Data Input"> <mx:TextInput id="text1" /> <mx:TextInput id="text2" /> <mx:TextInput id="text3" /> <mx:Button id="adbutton" label="Add Text" click="makethechange();"/> </mx:Panel> </mx:HBox> </mx:Application> Thanks, Kai ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- 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/

