...
>On one hand: Class mappings won't work with VO's insite another VO.
...
This works for me
public class FaceVO implements ValueObject{
...
        public var printAreas:Array
    }
in component that binds  vo (FaceVO instance)
for(var i:uint=0;i<data.printAreas.length;i++){

            var row:PrintAreaVO=PrintAreaVO(data.printAreas[i])
            //trace("is instance: "+(row is PrintAreaVO)) //traces "is instance:  true"
}

Robert Was


Andrea Varga wrote:

  

Hi All!

I'm going to ask my question through an example. (I'm using Cairngorm,
but I think the problem is general)
Let's say I have a database with 2 tables:

1. user -> with fields: user_id, user_name, user_country_id (foreign
key from country table)
2. countries -> with fields: country_id, country_name

Let's say I need an application that lists all the users, in a datagrid
with 2 columns: User Name, Country Name.
How should I approach this?

Let's say I have 2 VO's, to reflect the database structure:

class UserVO {
public var ID:int;
public var name:String;
public var countryID:int;
}

class CountryVO {
public var ID:int;
public var name:String;
}

And I have in my Model:

users:ArrayCollection; // array collection of UserVOs
countries:ArrayCollection; // array collection of CountryVOs

How could I create a binding of users to a Datagrid, so it will display
the country names?
Or how else should I approach the problem?

In case I have:
class UserVO {
public var ID:int;
public var name:String;
public var country:countryVO;
}

I think the bindig would be possibe, but a bunch of other
questions/problems appear.
Eg.:
I'm using remoting to get the data from the server (AMFHP).
On one hand: Class mappings won't work with VO's insite another VO.
On second hand: I have to load the list of countries (I need it
somewhere else), and I would not want to carry the CountryVO inside the
UserVO, for many reasons. One of them is: this is a simple example, but
what if CountryVO is a more complex data, and i need to send a userVO to
the server (to update the database for example), I don't need a
CountryVO there, just a UserVO that has the ID of a country.

Thanks,
Andi

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to