Hi,
 
Maybe you left it out in your example, but do you have the DataGridColumn tags? Like so:
 
<mx:DataGrid width="436" height="100%">
                <mx:dataProvider>
                    {person.phones}
                </mx:dataProvider>
        <mx:columns>
        <mx:Array>
            <mx:DataGridColumn headerText="number" width="125" labelFunction="zip"/>
            <mx:DataGridColumn headerText="info" width="125" columnName="name1" />
            <mx:DataGridColumn headerText="type" columnName="type" />
        </mx:Array>
        </mx:columns>
</mx:DataGrid>
 
Perhaps you should show us the piece of code that sets the dataProvider of the DataGrid. I think the problem lies there.
 
Dimitrios "Jimmy" Gianninas
RIA Developer
Optimal Payments Inc.
 


From: Christoph Guse [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 08, 2005 1:36 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] complex Remote Objects

Hi Peter,

I still have the problem with my complex Remote Objects. Here is some code and other stuff:

Output:
DataGrid

Implementation in MXML:

          <mx:DataGrid width="436" height="100%">
                <mx:dataProvider>
                    {person.phones}
                </mx:dataProvider>
           </mx:DataGrid>

Input in person from remote method:

Info: Serializing response
  (Message #0 targetURI=/7/onResult, responseURI=null)
    (Typed Object #0 'ogo.vo.OgoPersonVO')
      addresses = (Array #1)
        [0] = (Typed Object #2 'ogo.vo.OgoAdressVO')
          country = "Deutschland"
          type = "location"
          street = "Albertus-Magnus-Weg 16"
          name2 = "Standortadresse"
          _remoteClass = "ogo.vo.OgoAdressVO"
          state = "NRW"
          name3 = "name3"
          zip = "48565"
          name1 = "Henning Guse"
          city = "Steinfurt"
          id = "skyrix://renner.flex/default/10710"
        [1] = (Typed Object #3 'ogo.vo.OgoAdressVO')
          country = "Deutschland"
          type = "private"
          street = "Albertus-Magnus-Weg 16"
          name2 = "Privatadresse"
          _remoteClass = "ogo.vo.OgoAdressVO"
          state = "NRW"
          name3 = "name3"
          zip = "48565"
          name1 = "Henning Guse"
          city = "Steinfurt"
          id = "skyrix://renner.flex/default/10690"
        [2] = (Typed Object #4 'ogo.vo.OgoAdressVO')
          country = "Deutschland"
          type = "mailing"
          street = "Albertus-Magnus-Weg 16"
          name2 = "Postadresse"
          _remoteClass = "ogo.vo.OgoAdressVO"
          state = "NRW"
          name3 = "name3"
          zip = "48565"
          name1 = "Henning Guse"
          city = "Steinfurt"
          id = "skyrix://renner.flex/default/10700"
      objectVersion = 32.0
      isComplete = true
      jobTitle = "Vater"
      login = "OGo10610"
      _remoteClass = "ogo.vo.OgoPersonVO"
      lastChanged = Sat May 28 14:04:04 CEST 2005
      salutation = "06_geehrt_herr"
      comment = "hier kommt die Bemerkung rein"
      id = "skyrix://renner.flex/default/10610"
      vorname = "Henning"
      phones = (Array #5)
        [0] = (Typed Object #6 'ogo.vo.OgoPhoneVO')
          info = "privat"
          telephoneId = 10770.0
          type = "01_tel"
          _remoteClass = "ogo.vo.OgoPhoneVO"
          number = "02552-996021"
        [1] = (Typed Object #7 'ogo.vo.OgoPhoneVO')
          info = "auch privat"
          telephoneId = 10740.0
          type = "02_tel"
          _remoteClass = "ogo.vo.OgoPhoneVO"
          number = "02552-996023"
        [2] = (Typed Object #8 'ogo.vo.OgoPhoneVO')
          info = "mobilinfo"
          telephoneId = 10760.0
          type = "03_tel_funk"
          _remoteClass = "ogo.vo.OgoPhoneVO"
          number = "mobil"
        [3] = (Typed Object #9 'ogo.vo.OgoPhoneVO')
          info = " tel privat info"
          telephoneId = 10750.0
          type = "05_tel_private"
          _remoteClass = "ogo.vo.OgoPhoneVO"
          number = "tel privat"
        [4] = (Typed Object #10 'ogo.vo.OgoPhoneVO')
          info = "fax info"
          telephoneId = 10730.0
          type = "10_fax"
          _remoteClass = "ogo.vo.OgoPhoneVO"
          number = "fax"
        [5] = (Typed Object #11 'ogo.vo.OgoPhoneVO')
          info = "fax privat info"
          telephoneId = 10720.0
          type = "15_fax_private"
          _remoteClass = "ogo.vo.OgoPhoneVO"
          number = "fax privat"
      email1 = "[EMAIL PROTECTED]"
      url = "" class=moz-txt-link-rfc2396E href="http://guse.conquer.de">"http://guse.conquer.de"
      degree = "keiner"
      phoneTypes = (Array #12)
        [0] = "01_tel"
        [1] = "02_tel"
        [2] = "03_tel_funk"
        [3] = "05_tel_private"
        [4] = "10_fax"
        [5] = "15_fax_private"
      otherTitle2 = "Pferdeheld"
      number = "OGo10610"
      email2 = "[EMAIL PROTECTED]"
      nickname = "Henna"
      gender = "male"
      owner = (Typed Object #13 'ogo.vo.OgoMinimalPersonVO')
        login = "knuffel"
        _remoteClass = "ogo.vo.OgoMinimalPersonVO"
        id = "skyrix://renner.flex/default/10360"
      isPrivate = true
      email3 = "email3"
      keywords = ""
      firmen = (Array #14)
      contact = (Typed Object #15 'ogo.vo.OgoMinimalPersonVO')
        login = "knuffel"
        _remoteClass = "ogo.vo.OgoMinimalPersonVO"
        id = "skyrix://renner.flex/default/10360"
      nachname = "Guse"
      otherTitle1 = "Knorzel"
      middlename = "Michael"
      firstname = "Henning"
      isAccount = true

I attached the JavaVOs and the AsVOs as file.

I still don't know why I'm not able to access person.phones (person.addresses doesn't work too ). If I go through person.phones and do if(person.phones[i] instanceof OgoPhoneVO) I get true. 
I tried implicit getters / setters, but this wasn't a real success. As mentioned in "developing rich clients with macromedia flex" on page 470 in the grey box, implicit getters/setters should not be used with RemoteObjects.

After 2 days trying I don't have any more idea. I bet I am making a tiny mistake, but I can't figure out what it is.

Greets
Christoph


Peter Farland wrote:
If you've used Object.registerClass on both Phones and Person classes there should be no problem with them being returned in an Array (that is, the Flash Player creates the Phones instances during deserialization no matter how deeply nested).

When you say:

"There are objects in ApplicationPerson.phones but it seems the information which type of objects are in it is gone."

How do you test that this type information is lost? You could add a method to the Phones class, such as:

class Phones{
    public var number:String;
    public var info:String;
     
    public function test():String {
        return ("My info is: " + info);
    }
}

Then call .test() on an Array member that is supposed to be of type "Phones" - if the call succeeds then you have an instance of Phones, if not, then perhaps you just have a generic Object.

If the call did succeed, then perhaps you've uncovered a bug (possibly in DataGrid and its interaction with deserialized objects)? Let me know how the test goes and I'll pass on to QA to test.


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Christoph Guse
Sent: Friday, June 03, 2005 10:50 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] complex Remote Objects

Hi List,

I use some complex Remote Objects. Let me give an example:

class Phones{
    public var number:String;
    public var info:String;
}

class Person{

    public var   name:String;
    public var firstname:String;
    public var phones:Array;

}

These are only example classes. In my app they are more complex and of
course I uses Object.registerClass().

The phones array in the Person class contains some Phones Objects. Let's
say I have a Person object ApplicationPerson in my app and
ApplicationPerson is filled with values by a remote call. There is
absolutely no problem to access ApplicationPerson.name and
ApplicationPerson.firstname, but when I try to fill a DataGrid with
ApplicationPerson.phones nothing is shown. There are objects in
ApplicationPerson.phones but it seems the information which type of
objects are in it is gone.
The only possibility I found to access ApplicationPerson.phones is to
put a getPhones method in the class Person in which I cast every item in
phones. getPhones could look like this:

public function getPhones():Array{
    var ret:Array = new Array();
    for(var i=0; i < phones.length; i++){
        ret.push(Phones(phones[i]);
    }
    return ret;
}

Is a explicit getter-method the onliest chance to deal with complex
Remote Objects or is there a possibility of "deep-cast" Flex does on its
own?

Greets
Christoph


--
****************************************
Christoph Guse
Löhstraße 34
41747 Viersen
Tel.  0 21 62 / 50 24 066
Mobil   01 72 / 160 74 84
VoIP  0 12 12 / 39 64 48 831
****************************************




Yahoo! Groups Links







-- 
****************************************
 Christoph Guse
 Löhstraße 34
 41747 Viersen
 Tel.  0 21 62 / 50 24 066
 Mobil   01 72 / 160 74 84
 VoIP  0 12 12 / 39 64 48 831
****************************************


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 Links

Reply via email to