Alex, thanks for the reply.  I tried that, but had problems figuring out
how to put the "name" in.  I may not have explained very well.

 

Let's say I have the following datagrid with an id="books":

 

+-------------+----------+-------+------------+

| Condition   | Course   | Price | Bookname   |

+-------------+----------+-------+------------+

| In Plastic  | EMB 101  | 100   | Embryology |

| Well-read   | EMB 102  | 75    | Embryology |

| In Plastic  | Anat 101 | 100   | Anatomy    |

| In Plastic  | Anat 101 | 100   | Anatomy    |

| Highlighted | Anat 102 | 25    | Anatomy    |

| Well-read   | Surg 101 | OBO   | Surgery    |

+-------------+----------+-------+------------+

 

 

The user can click in any cell in any row or column.  If the user clicks
in row2, column3, I can use rowIndex and columnIndex to get 2 and 3.  I
could get the data by doing books[2].Bookname, but how do I know that
Bookname is the heading for column 3? I could do a lookup that says if
columnIndex==3, then fieldname=Bookname, but how do I use a string
variable in the call?  I know I can do books[rowIndex].Bookname to get
the data, but how do I use a variable for the column name?

 

Or do I just know that because I'm hardcoding in the field names for the
columns in the DataGridColumn?  If I just let the DataGrid component
build the columns, then the columns are dependent on the order of the
fields in the underlying database format and if I ever have to change
that format, then I'd have to update all of this.  I'd like something a
little more portable.

 

Did I explain that ok?

 

Thanks for your help!  It really is appreciated!

 

Bob

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Monday, October 15, 2007 1:59 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] value of clicked/focused cell in a datagrid

 

acMyStuff[i] is the data object in the dataprovider, but normally those
things are objects with fields and not another array.  Your
datagridcolumns use .datafield to pull the field. So it would be
something like acMyStuff[1].name

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ramsey, Robert L
Sent: Monday, October 15, 2007 10:42 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] value of clicked/focused cell in a datagrid

 

Ok, I am definitely being a real idiot here.  All I want to do is find
out the value of cell that a user has clicked on, tabbed into, or
entered into.  I can get the row number and column number, but I can't
find the syntax to get the data out of the arraycollection.  For other
languages, I'd just do something like val = acMyStuff[1][4] to get the
data from the multidimensional array.  Any ideas?

 

Thanks.

 

Bob

 

Reply via email to