各位好..我寫了一個要用在AdvanceDataGrid的function在PHP裡面
內容為下
<?
//pos.php
session_start();
header('Content-type: text/html; charset=UTF-8');
class pos
{
function SearchAccountBox_Invoice()
{
$ArrayB=array(
array("product_id"=>"幼稚園B")
,
array("product_id"=>"國小B")
,
array("product_id"=>"國中B")
);
$Array=array(
array("product_id"=>"幼稚園A","children"=>$ArrayB)
);
return($Array);
}
}
?>
這裡是flex AdvanceDataGrid的設定,是一個module
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="
http://www.adobe.com/2006/mxml" layout="absolute"
width="1000" height="1000" creationComplete="SearchMdyBox();">
<mx:Script source="../config/
config.as" />
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.controls.CheckBox;
import mx.managers.PopUpManager;
import mx.collections.ArrayCollection;
[Bindable]
public var boxdp:ArrayCollection=new ArrayCollection();
public function SearchMdyBox():void
{
geteway_conn.connect(gateway_url);
geteway_conn.call("pos.SearchAccountBox_Invoice", new
Responder(SearchProductResult,CreateMemberAddFault)
);
}
private function SearchProductResult(evt:Array):void
{
boxdp=new ArrayCollection(evt);//
Alert.show(evt[0].id);
}
private function CreateMemberAddFault(fault:String):void
{
Alert.show("可能目前伺服器有問題或資料數為0","資料沒讀到",Alert.OK);
}
]]>
</mx:Script>
<mx:AdvancedDataGrid x="10" y="10" id="adg1"
designViewDataType="tree" width="875" height="432"
dataProvider="{boxdp}">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="產品ID" dataField="product_id"/
>
<mx:AdvancedDataGridColumn headerText="產品編號" dataField="product_no"/
>
</mx:columns>
</mx:AdvancedDataGrid>
<mx:Button x="10" y="450" label="Button" click="SearchMdyBox();"/>
</mx:Module>
結果只出現一行....就是幼稚園,AdvDataGrid並沒出現tree的功能,想請教各位先進...是否AmfPHP只能傳簡單的陣列...