简体   繁体   中英

How do you get a cell value of a selected row in an mx.dataGrid in flash builder

I thought I could use...

studentID = myDataGid.selectedItem.studentID

Does not want to work for me. Tracing the expression in debug it is returning "XMLList (@11e55e8d1)".

The datasource is an XMLListCollection. tracing the expression myDataGid.selectedItem I can see the studentID node and it has a value.

What am I doing wrong?

I see that starting with Flex 4.5, Adobe recommends that we use the spark.components.DataGrid class as an alternative to the mx:dataGrid which I am not at all familiar with or where to start to learn. I have this mx:dataGrid all setup and otherwise working and would prefer not to have to learn something new.

Thanks,

John

That looks ok - it returns the part of the xml data that you need. I presume it's a matter of getting the data:

studentID = myDataGid.selectedItem.studentID.toXMLString();

The above returns the XMLList as a string, but you might need to get that as a Number (depending on the structure of your XML which isn't visible).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM