Flex 应用Remote与后台通信
1.创建模拟Services:(DataRomate.java类中getList()方法遍历数据)
2.配置:remoting-config.xml
3.*.mxml获取数据:
A : getData(event:ResultEvent)方法实现数据绑定
B: 组件设置:
C:设置DataGrid组件:
注意:creationComplete="DataRo.getList()" : getList()对应DataRomate.java类中getList()方法。
本文转自:http://lincoln-zhou.javaeye.com/blog/373356
- 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;
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()方法。
本文转自:http://lincoln-zhou.javaeye.com/blog/373356
如果你喜欢本文, 请长按二维码,关注公众号 分布式编程.
作者:分布式编程
出处:https://zthinker.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。