我不知道我在做什麼錯,所以也許有人可以解釋給我。我需要幫助清單dataprovider
我有AMFPHP被髮回對象的數組,它看起來像這樣:
(Object)#0
content = (Array)#1
[0] (Object)#2
config = "1"
id = "3"
param = "3"
title = "categorypreview"
[1] (Object)#3
config = "0"
id = "1"
param = "-1"
title = "highestdisplay"
[2] (Object)#4
config = "0"
id = "8"
param = "-1"
title = "featured"
header = (Array)#9
[0] (Object)#10
config = "1"
id = "9"
param = "5"
title = "categorymenu"
[1] (Object)#11
config = "1"
id = "6"
param = "1"
title = "adzones"
,我使用MXML是:
<s:List id="headerList" y="52" left="10" width="200" height="150">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
</s:List>
<mx:DataGrid id="mydatagrid" x="10" y="214">
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="title"/>
<mx:DataGridColumn headerText="Column 2" dataField="param"/>
</mx:columns>
</mx:DataGrid>
的動作是:
protected function getLayoutResultHandler(event:ResultEvent):void
{
mydatagrid.dataProvider = event.result.header;
headerList.dataProvider = event.result.header;
}
datagrid就在那裏進行測試。 ,我遇到的問題是數據網格與底座陣列的值填充,但名單給我的錯誤:
類型強制失敗:無法轉換[] @ dcc5629到mx.collections.IList
我在做什麼錯?
使用amfphp版本1.9,數組結果在「event.result」對象中,我必須將其轉換爲ArrayCollection構造函數中的Array。否則,這工作得很好,謝謝! – 2011-08-19 05:10:49