enter and save data in a table.

hi guys

I have a requirment where i want the users to enter data in a table. I should be able to store that data in an array (or an arraylist or any collection) and pass it to the backend.
Any idea how i can do that?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this code:

			import mx.events.DataGridEvent;
			import mx.events.FlexEvent;

			private var rows:Array = [	{col1:11, col2:12, col3:13},
										{col1:21, col2:22, col3:23},
										{col1:31, col2:32, col3:33},
										{col1:41, col2:42, col3:43}];

			private var modifiedData:Object = {};

			protected function datagrid1_initializeHandler(event:FlexEvent):void{
				event.target.addEventListener(DataGridEvent.ITEM_EDIT_END, onColumnChanged);

			protected function onColumnChanged(event:DataGridEvent):void{
				if(modifiedData[event.rowIndex] == undefined)
					modifiedData[event.rowIndex] = {};
				var data:Object = dg.itemEditorInstance[dg.columns[event.columnIndex].editorDataField];
				modifiedData[event.rowIndex][event.dataField] = data;
	<mx:DataGrid id="dg" dataProvider="{rows}" editable="true" initialize="datagrid1_initializeHandler(event)">
			<mx:DataGridColumn dataField="col1"/>
			<mx:DataGridColumn dataField="col2"/>
			<mx:DataGridColumn dataField="col3"/>

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
royjaydAuthor Commented:
thanks, works for me.
Any help with my next question will be greatly appreciated
Its related to the expand-collapse functionality which you helped me with before but slightly different.


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Flex

From novice to tech pro — start learning today.