开发者

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


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;


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜