Flex Datagrid select multiple rows and send to amfphp backend

浪子不回头ぞ 提交于 2019-12-11 09:56:30

问题


I was researching over the forums around the internet for some solution to send and ArrayCollection to AmfPHP but I didn't find good responses for that and how I can access the array on PHP side to include into a MySQL table.

My problem:

I have a Flex datagrid populated with some Name and Email and I want create a way to permit users to create a group and select the Name to be part of this group. I saw in Flash Builder debugger that the data are being send good as ArrayCollection (transformed from Vector to Object also) and the problem still in how can I access this array on PHP side.

Here is ArrayCollection being send to AmfPHP:

[0] Object (@cf87311)   
[1] Object (@d4bfcb9)   
[2] Object (@d4d3479)   

Here is the keys and values of the Array:

[0] Object (@cf87311)   
    id  "2" 
    nome    "David" 
    username    "david" 
[1] Object (@d4bfcb9)   
    id  "3" 
    nome    "jose"  
    username    "jose@jose.com" 
[2] Object (@d4d3479)   
    id  "4" 
    nome    "joao"
    username    "joao@joao.com" 

Does anyone know what I have to do to have access to the field "id" in this array ?

Best Regards !

Rafael Tavares


回答1:


AMFPHP will translate your actionscript object into a PHP object. Pass the arraycollection as one param. On the PHP side you would use it as:

function myfunction( $Object_param )
{
   foreach( $Object_param as $Object )
   {
       echo $Object[ 'id' ];
       echo $Object[ 'nome' ];
   }
}

and so on.



来源:https://stackoverflow.com/questions/13548488/flex-datagrid-select-multiple-rows-and-send-to-amfphp-backend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!