I'm not sure what you mean, or why you would want to "push them down." but you can add more rows by adding more rows to the array... The datagrid just displays what is in the array. So, just copy that values.push() line, and put different (or blank) values in .
~sean On Wed, Jul 2, 2008 at 10:24 AM, Santhosh Garlapad < [EMAIL PROTECTED]> wrote: > Hi Sean, > > Thannks for the suggestion. > How can push the values down if i want to add few more rows in the > datagrid? > Do i need to loo through the datagrid? > > Thanks > Santosh > > > > > > ----- Original Message ---- > From: Sean Clark Hess <[EMAIL PROTECTED]> > To: flexcoders@yahoogroups.com > Sent: Wednesday, July 2, 2008 8:32:51 AM > Subject: Re: [flexcoders] display text input values in datagrid > > You want to change your val() function to something more like this. > > private function val():void > { > var values:Array = new Array(); > > // this is only one row > values.push( {tt1:pp1. text, tt2:pp2.text, > tt3:pp3.text} ); > > > dg.dataProvider= values; > } > > The dataProvider for a datagrid should be something like an array (because > of all the rows). Each row should be an object with fields (like "tt1" > "tt2" and "tt3") > > On Tue, Jul 1, 2008 at 8:43 PM, Santhosh Garlapad <santhoshgarlapad@ > yahoo.com <[EMAIL PROTECTED]>> wrote: > >> Hi guys, >> >> i m a beginner to flex development. >> >> i have few text input fieds and when i click add button all the text input >> values to be displayed in datagrid. >> >> if i add few more items into the datagrid the values the new values >> display first >> >> sample datagrid as follows; >> column1 col2 col3 >> text1 text 2 text3 >> texta textb textc >> >> please find the sample code below'' >> >> <?xml version="1.0" encoding="utf-8"?> >> <mx:Application xmlns:mx="http://www.adobe. com/2006/ >> mxml<http://www.adobe.com/2006/mxml>" >> layout="absolute"> >> >> <mx:Script> >> <![CDATA[ >> private function val():void >> >> { >> dg.dataProvider= pp1.text; >> } >> ]]> >> </mx:Script> >> >> <mx:TextInput x="170" y="73" id="pp1"/> >> <mx:TextInput x="170" y="73" id="pp2"/> >> <mx:TextInput x="170" y="73" id="pp3"/> >> <mx:DataGrid x="207" y="144" id="dg"> >> <mx:columns> >> <mx:DataGridColumn headerText="Column 1" dataField="tt1"/> >> <mx:DataGridColumn headerText="Column 2" dataField="tt2"/> >> <mx:DataGridColumn headerText="Column 3" dataField="tt3"/> >> </mx:columns> >> </mx:DataGrid> >> <mx:Button x="85" y="134" label="Button" click="val()"/> >> >> </mx:Application> >> >> can anyone help with the script.. >> >> thanks >> san >> >> >> > > >