[flexcoders] Value Object Help

2005-03-31 Thread digital_eyezed


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 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/
 





RE: [flexcoders] Value Object Help

2005-03-31 Thread Dimitrios Gianninas





Hi,

No need to do anything special, 
just do:

myDataGrid.dataProvider = 
remoteObject.result;

Then the data grid should be 
declared as follows:

mx:DataGrid id="myDataGrid"
mx:columns
 
mx:Array
 
mx:DataGridColumn columnName="name" headerText="Name" /
 
mx:DataGridColumn columnName="total" headerText="Total" /
 
mx:DataGridColumn columnName="today" headerText="Today" /
 
/mx:Array 
/mx:columns
/mx:DataGrid

No need to 
iterate.

Jimmy 
Gianninas
Software Developer - 
Optimal Payments 
Inc.



From: digital_eyezed 
[mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 9:19 
AMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Value Object Help
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).CheersJava: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; 
}}

AVIS IMPORTANTWARNING Les informations contenues dans le present document et ses pieces jointes sont strictement confidentielles et reservees a l'usage de la (des) personne(s) a qui il est adresse. Si vous n'etes pas le destinataire, soyez avise que toute divulgation, distribution, copie, ou autre utilisation de ces informations est strictement prohibee. Si vous avez recu ce document par erreur, veuillez s'il vous plait communiquer immediatement avec l'expediteur et detruire ce document sans en faire de copie sous quelque forme. The information contained in this document and attachments is confidential and intended only for the person(s) named above. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution, or any other use of the information is strictly prohibited. If you have received this document by mistake, please notify the sender immediately and destroy this document and attachments without making any copy of any kind.









Yahoo! Groups Sponsor


  ADVERTISEMENT 












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 the Yahoo! Terms of Service.