Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get or Set Cell Values in a Datagrid progmatically

In Flex 4 using a pre populated data grid, how can I get or set specific values programatically, IE I wont be using selectedItems etc.

How do I reference the value of a cell in row 4 colum 6 for example.

Please and thank you in advance for your help.

Craig

like image 217
Craig Mc Avatar asked Feb 27 '23 02:02

Craig Mc


1 Answers

Cast the dataProvider of the DataGrid to ListCollectionView and use its getItemAt method.

ListCollectionView(dataGrid.dataProvider).getItemAt(requiredRow).appropriateProperty = newValue;

Update: In case the column name is dynamic, you can fetch it using something like:

var data_field:String = dgViewPreview.columns[6].dataField; //for 6th column
ListCollectionView(dataGrid.dataProvider).getItemAt(requiredRow)[data_field] = newValue;
like image 109
Amarghosh Avatar answered Mar 06 '23 23:03

Amarghosh