将整个Datagrid列从flex发送到PHP

时间:2009-11-04 13:35:04

标签: flex

My Main.MXML

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
          xmlns:mate="http://mate.asfusion.com/" width="100%" height="100%">


     <mx:AdvancedDataGrid sortExpertMode="true" id="baselineGrid" dataProvider="{dataSource}"
            headerSeparatorSkin="mx.skins.ProgrammaticSkin"
            headerSortSeparatorSkin="mx.skins.ProgrammaticSkin" paddingLeft="30" variableRowHeight="true" width="296" x="32" y="143">
 <mx:columns> 
  <mx:AdvancedDataGridColumn dataField="col2" width="100" headerText="Weightage" />
  <mx:AdvancedDataGridColumn id="baseL" dataField="col3" itemRenderer="DetailGrid" headerText="Define Baseline" width="50" />
 </mx:columns> 
</mx:AdvancedDataGrid>

</mx:Canvas>

的ItemRenderer

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off">

<mx:NumberValidator id="Baseline_Val" source="{baselineRating}" required="true" 
  lowerThanMinError="This field is required."
        property="selectedIndex"
        minValue="0" />
    <mx:ComboBox prompt="Select" id="baselineRating" change="getValue()" width="100">
 <mx:String></mx:String>
 <mx:String>0</mx:String>
 <mx:String>1</mx:String>
 <mx:String>2</mx:String>
 <mx:String>3</mx:String>
 </mx:ComboBox>
</mx:HBox>

我需要将整个datagrid列发送到PHP。如何发送第1列和第2列的所有值。

注意:COlumn 2是一个itemRenderer,它有一个组合框。

1 个答案:

答案 0 :(得分:1)

将集合转换为合适的格式,如xml或json,并通过URLLoader发送。

var result:XML = <root/>;
for each(var item:Object in dataSource)
{
  //declare itemToString based on your needs.
  result.appendChild("<item>" + itemToString(item) + "</item>");
}