How to access a cell Value in a Flex datagrid ?

29 01 2010

Unfortunately currently there is no easy way to get a cell value for a datagrid.There is already an enhancement request logged for this http://bugs.adobe.com/jira/browse/FLEXENT-826 If this fix is important to you please vote on this.

As of now to access a cell value this is what you will need to do

  1. Use selectIndex to choose the particular row
  2. Use GetROProperty(“selecteditem”) to get the entire contents of that row
  3. Using the split function you can then split the row contents to the contents of each cell using | as the delimiter

 Please find the sample code below

 Browser(“Browser”).FlexApplication(“dg”).FlexPanel(“DataGrid Control Example”).FlexDataGrid(“dg1″).SelectIndex 0

RowContents  =Browser(“Browser”).FlexApplication(“dg”).FlexPanel(“DataGrid Control Example”).FlexDataGrid(“dg1″).GetROProperty(“selecteditem”)

CellContents =Split(RowContents,”|”,-1)

msgbox CellContents(0)

msgbox CellContents(1)

msgbox CellContents(2)

Hope this helps!

About these ads

Actions

Information

3 responses

2 03 2010
Vijay Mareddy

How do u refer a row in an Advanced Data Grid when u use itemEditors (combo) ?
Currently, the automationname is a rowdata pipe separated and it is difficult to write a script to refer the column and set a value to a particular column (itemeditor)
Can i refer it with the data.label i.e FlexAdvancedDataGrid(data.label).FlexComboBox()
Could u post a blog related to this?

3 03 2010
svakil

Hi
I didnt quite understand your requirment.Maybe you can mail me a sample mxml file and i will look into it.Please mail me at svakil@adobe.com

3 03 2010
Vijay Mareddy

emailed you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

%d bloggers like this: