flex RemoteObject 中datagrid 于Java list的数据传递

public class EmployeeInfo {
	public Employee emp = new Employee();
	public Employee em = new Employee();
	public List<Employee> list = new ArrayList<Employee>();
	
	public List<Employee> readInfo(){
		emp.setId("22222");
		emp.setName("aaaa");
		emp.setGender("Fmale");
		emp.setEmail("asdf@adf");
		emp.setPhone("7654321");
		list.add(emp);
		list.add(em);
		return list;
	}
Employee为自己定义的一个类。


Remoting-config 配置
<destination id="EmployeeInfoRemoting">
	 <properties> 
		 <source>com.EmployeeInfo</source> 
	 </properties> 
	</destination>


<mx:Button y="10" label="Query" id="queryBtn" horizontalCenter="303" click="showEmployees()"/>
<mx:DataGrid y="156" width="674" height="357" horizontalCenter="0" id="dg">
<mx:columns>
<mx:DataGridColumn headerText="Select" itemRenderer="object.MyCheckBox" headerRenderer="mx.controls.CheckBox"/>
<mx:DataGridColumn headerText="ID" dataField="id"/>
<mx:DataGridColumn headerText="Name" dataField="name"/>
<mx:DataGridColumn headerText="Gender" dataField="gender"/>
<mx:DataGridColumn headerText="Email" dataField="email"/>
<mx:DataGridColumn headerText="Phone Number" dataField="phone"/>
</mx:columns>
</mx:DataGrid>

<mx:RemoteObject destination="EmployeeInfoRemoting" id="emInfo"
result="dataInit(event)"
endpoint="http://localhost:8080/MyTest/messagebroker/amf">		
</mx:RemoteObject>

private function dataInit(event:ResultEvent):void{
			dg.dataProvider = event.result;
}
private function showEmployees():void{ 
			emInfo.readInfo();
}

你可能感兴趣的:(java,Flex)