Kevin
Kevin

Reputation: 23634

sending entire columns of Datagrid from flex to PHP

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>

I need to send the entire datagrid columns to PHP. How to send all the values of the column 1 and column 2.

Note: COlumn 2 is an itemRenderer which has a combo box.

Upvotes: 0

Views: 309

Answers (1)

Amarghosh
Amarghosh

Reputation: 59451

Convert the collection into a suitable format like xml or json and send it through URLLoader.

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

Upvotes: 1

Related Questions