You don't need to convert the array, the DataGrid can automatically
databind to the returned array and display a row for each object in the
returned array.
E.g., if you define your RemoteObject call like:
<mx:RemoteObject id="myServices"
source="com.testcompany.myServices">
<mx:method name="findTestVOs"/>
</mx:RemoteObject>
And, the findTestVOs method invocation returns either an Array or
Collection of testVO objects then you can put the following into your
mxml file:
<mx:DataGrid dataProvider="{myServices.findTestVOs.result}">
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="name" headerText="My Name"/>
<mx:DataGridColumn columnName="total" headerText="Total"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
Two notes on your ActionScript TestVO class...
1. Make sure to register the mapping from Java TestVO to ActionScript
TestVO. This tells the flash remoting the mapping between
Java/ActionScript classes, so when performing marshalling it knows which
class to instantiate. The following code accomplishes this:
public static var regClass =
Object.registerClass("com.testcompany.TestVO",com.testcompany.TestVO);
2. ActionScript doesn't have the notion of floats... only Numbers. In
your code below you mention floats.
-ashley
digital_eyezed wrote:
>
> Hi,
>
> I need a little help:
>
> I have a remoteobject which returns an array of Value Objects. The
> value object contains two ints (numbers) and a string. I want to
> display this on a datagrid. How do I convert this array into
> something that I can use?
>
> I have created an actionscript class (testVO.as) which mirrors the
> java Class testVO so I think I'm going in the right direction, now
> all I need to do is iterate through the array (remoteObject.result,
> which is where I am stuck (my actionscript is obviously a bit rusty).
>
> Cheers
>
> Java:
>
> public class TestVO {
> public String name;
> public int total;
> public int today;
>
> public void setName(String name){
> this.name = name;
> }
> public void setToday(int today){
> this.today = today;
> }
> public void setTotal(int total){
> this.total = total;
> }
> public String getName(){
> return this.name;
> }
> public float getTotal(){
> return this.total;
> }
> public float getToday(){
> return this.today;
> }
> }
>
> ActionScript:
>
> public class TestVO {
> var name:String;
> var total:Number;
> var today:Number;
>
> public void setName(name:String){
> this.name = name;
> }
> public void setToday(today:Number){
> this.today = today;
> }
> public void setTotal(total:Number){
> this.total = total;
> }
> public String getName(){
> return this.name;
> }
> public float getTotal(){
> return this.total;
> }
> public float getToday(){
> return this.today;
> }
> }
>
>
>
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> click here
> <http://us.ard.yahoo.com/SIG=129paac65/M=298184.6018725.7038619.3001176/D=groups/S=1705007207:HM/EXP=1112365160/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075>
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/flexcoders/
>
> * To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/