It looks like you're replacing the selectedItem with one of its subproperties. Don't you need to do an editField instead of replaceItemAt to assign the right property?
-----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of rgwilson26 Sent: Wednesday, April 05, 2006 11:37 AM To: [email protected] Subject: [flexcoders] Populate datagrid columns via titlewindow text input boxes I am working on an app with a datagrid and button where the user will click a button to display a titlewindow with various intput boxes to populate rows in the datagrid. At the moment I can only get one object to populate (the very first column and no others) the dg. My question is how can I pass multiple text input box objects back to my app from the titlewindow via my dispatch events and populate each column in my dg with the text inputs from the Titlewindow? Also, is there a way to auto select the first index of a datagrid so it is highlighted when the app loads? I tried initilaize="{myDG.selectedIndex = 0}" with no luck. Any suggestions? Here is my code: **************************************** main app **************************************** <mx:Script> <![CDATA[ public function showPopUp():Void{ var myPopUp = new Object(); myPopUp.lessonsLearned = dgLessonsLearned.selectedItem.lessonsLearned; myPopUp.needToKnow = dgLessonsLearned.selectedItem.needToKnow; myPopUp.shareInfo = dgLessonsLearned.selectedItem.shareInfo; var t:Object = TitleWindow(PopUpManager.createPopUp(this, llPopUp, false, lessonsPopUp, false)); t.addEventListener("lessonsLearnedUpdate", this); t.addEventListener("needToKnowUpdate", this); t.addEventListener("shareInfoUpdate", this); } public function handleEvent(evt:Object):Void { //does not populate datagrid row :( if (evt.type == "lessonsLearnedUpdate") dgLessonsLearned.replaceItemAt(dgLessonsLearned.selectedIndex, {lessonsLearned: evt.Result}); if (evt.type == "needToKnowUpdate" ) dgLessonsLearned.replaceItemAt(dgLessonsLearned.selectedIndex, {needToKnow: evt.Result}); if (evt.type == "shareInfoUpdate" ) dgLessonsLearned.replaceItemAt(dgLessonsLearned.selectedIndex, {shareInfo: evt.Result}); } ]]> </mx:Script> <mx:DataGrid id="dgLessonsLearned"> <mx:columns> <mx:Array> <mx:DataGridColumn columnName="lessonsLearned"/> <mx:DataGridColumn columnName="needToKnow"/> <mx:DataGridColumn columnName="shareInfo"/> </mx:Array> </mx:columns> </mx:DataGrid> <mx:Button label="Add New Entry" click="showPopUp()" /> **************************************** TitleWindow component **************************************** <mx:Metadata> [Event("lessonsLearnedUpdate")] [Event("needToKnowUpdate")] [Event("shareInfoUpdate")] </mx:Metadata> <mx:Script> <![CDATA[ public var lessonsLearned:String; public var needToKnow:String; public var shareInfo:String; public function updateText(txtLessonsLearned:String, txtNeedToKnow:String, txtShareInfo:String):Void{ dispatchEvent({type:"lessonsLearnedUpdate", Result:txtLessonsLearned}); dispatchEvent({type:"needToKnowUpdate", Result:txtNeedToKnow}); dispatchEvent({type:"shareInfoUpdate", Result:txtShareInfo}); } ]]> </mx:Script> <mx:HBox width="100%"> <mx:TextArea id="txtLessonsLearned" width="300" height="200" text="{lessonsLearned}"/> <mx:TextArea id="txtNeedToKnow" width="300" height="200" text="{needToKnow}"/> <mx:TextArea id="txtShareInfo" width="300" height="200" text="{shareInfo}"/> </mx:HBox> <mx:Button label="Submit" width="75" click="updateText (txtLessonsLearned.text, txtNeedToKnow.text, txtShareInfo.text)" /> -- 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 -- 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/

