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?
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

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.


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.