1.创建模拟Services:(DataRomate.java类中getList()方法遍历数据)
public class DataRomate
{
public List getList()
{
List list = new ArrayList();
for(int i=0;i<10; i++)
{
Map map = new HashMap();
map.put("name", "name"+i);
map.put("description", "description"+i);
map.put("targeingexpression", "targeingexpression"+i);
map.put("userdby", "userdby"+i);
map.put("porfilechart", "porfilechart"+i);
list.add(map);
}
return list;
2.配置:remoting-config.xml
<destination id="DataRo">
<properties>
<source>com.test.DataRomate</source>
</properties>
</destination>
3.*.mxml获取数据:
A : getData(event:ResultEvent)方法实现数据绑定
public function getData(event:ResultEvent):void
{
dataGridId.dataProvider = event.result;
}
B: 组件设置:
<mx:RemoteObject id="DataRo" destination="DataRo" result="getData(event)" />
C:设置DataGrid组件:
<mx:DataGrid id="dataGridId" creationComplete="DataRo.getList()">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name"/>
<mx:DataGridColumn dataField="description" headerText="Description"/>
pression"/>
<mx:DataGridColumn dataField="userdby" headerText="Used by"/>
<mx:DataGridColumn dataField="porfilechart" headerText="Porfile Chart"/>
</mx:column
注意:creationComplete="DataRo.getList()" : getList()对应DataRomate.java类中getList()方法。