简体   繁体   English

如何将字符串转换为DataGrid中的对象名称selectedItem? flex3

[英]How to transform a String into an object name selectedItem in the DataGrid? flex3

I need to get the value of the item clicked and the name of the columns. 我需要获取单击的项目的值和列的名称。

   for each(item in colunas) {

         var itemok:String = item.dataField;
         Alert.show(''+datagridlist.selectedItem.itemok); // show value of column

    }

But this way it returns 'undefined'. 但是这样,它会返回“ undefined”。

But if I put the name already in function, I can get the correct data, example: 但是,如果我已经将名称放入函数中,则可以获取正确的数据,例如:

Alert.show(''+datagridlist.selectedItem.create); // create is a column name in mysql

But this variable must be created dynamically, example: 但是必须动态创建此变量,例如:

var itemok:String = item.dataField;
Alert.show(''+datagridlist.selectedItem.itemok); // show value of column

Could someone help me? 有人可以帮我吗? I'm at it on time and I can not convert the string to column name. 我按时到达,无法将字符串转换为列名。

I thank you all now 我现在谢谢大家

您的“ selectedItem”对象是否包含“ create”属性,或者仅仅是表行的名称?

question already resolved 问题已经解决

see as it was 照原样

Alert.show (''+ datagridlist.selectedItem [itemok]);

Thanks anyway to all and sorry for the two topics. 无论如何,谢谢大家,对两个话题深表歉意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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