2009-02-20 106 views
0

我在我的應用程序中有一個數據網格,並使用php從MYSQL數據庫中提取數據。 是存在於所有的數據存儲到一個數組並把它傳遞給功能或是否有可能只是直接存儲數據到一個數組而不是從數據網格 這裏拉的方式是代碼flex datagrid問題

<mx:DataGrid id="dgUserRequest" x="150" y="10" dataProvider=" {userRequest.lastResult.users.user}" editable="false"> 

    <mx:columns> 
     <mx:DataGridColumn headerText="UserID" dataField="userid"/> 
     <mx:DataGridColumn headerText="Ip Address" dataField="ip"/> 
     <mx:DataGridColumn headerText="latitude" dataField="lat"/> 
     <mx:DataGridColumn headerText="longitude" dataField="lng"/> 
    </mx:columns> 

</mx:DataGrid> 
<mx:HTTPService id="userRequest" url="http://localhost/post.php" useProxy="false" method="POST"> 
    <mx:request xmlns=""> 
    </mx:request> 
    </mx:HTTPService> 

回答

1

將偵聽器添加到HTTPService的「result」事件中,並讓偵聽器函數中的代碼填充本地存儲的陣列。

0

這樣的事情應該幫助

[Bindable] 
public var dp:ArrayCollection; 



protected function samplePhp_resultHandler(event:ResultEvent):void 
{ 
dp = event.result as ArrayCollection; 
} 

<mx:HTTPService id="userRequest" url="http://localhost/post.php"        useProxy="false"   
    method="POST" result="samplePhp_resultHandler"> 
<mx:request xmlns="">