Reputation: 505
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
Upvotes: 4
Views: 9742
Reputation: 477
There are two ways to access, based on Grid column DataField Mapping to object property or LabelFunction set to grid column
I pasted the scenario with example here http://pastebin.com/iwrnHD1c
Upvotes: 0
Reputation: 59451
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;
Upvotes: 8