views:

145

answers:

1

Hey all,

When I run the flex application, I'm expecting to see 25 records from users table of my database in a list component, and all I see is 25 of this: [object User]

I tried to follow this tutorial: http://www.adobe.com/devnet/flashcatalyst/articles/building_datacentric_app_flashcast_flashbuilder_03.html but as he is using ColdFusion, I am using an HTTP service type. Basically, what I did:

1) Connect to data service (Http) 2) Entered a url of xml data, method GET, operation of getAllItems 3) search as name string as data type for the parameters of this operation 4) users as service name (services.users as service package) 5) test operation (authentication required) and clicked test, which showed the xml data 6) Configure return type, selected User as root (not users), and clicked it for "is Array?" option 7) Then selected the list component, checked "New Service Call", and for bind_to_field I checked "id" (not sure exactly what bind to field does)

The following is the relevant stuff that was generated:

            protected function list_creationCompleteHandler(event:FlexEvent):void
        {
            getAllItemsResult.token = users.getAllItems(/*Enter value(s) for */ search);
        }

    <fx:Declarations>
    <s:CallResponder id="getAllItemsResult" />
    <users:Users id="users" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
</fx:Declarations> 

            <s:List skinClass="components.DataList3" x="65" y="96" change="list_changeHandler()" id="list" creationComplete="list_creationCompleteHandler(event)" dataProvider="{getAllItemsResult.lastResult}" labelField="id">
        </s:List>

I do notice an error message that says "access of undefined property search". But again this was generated code so I have no idea where it was supposed to be defined. My main concern is that it's not showing records from the database (via the xml) but rather just showing: [object User]

Thanks for any suggestions.

+1  A: 

What you are seeing is the default impl of Object.toString() which indicates the type of the object being displayed. It looks like the data is actually loading fine, you just haven't configured the List to display it properly. I see you are specifying a labelField value of "id" but perhaps that property doesn't actually exist on the objects being returned? You may want to try another value for labelField.

cliff.meyers
No matter what I change the labelField value to from the available list of options it gives, the same thing happens.
JohnMerlino
Are you using Flash Builder? If so you should drop a breakpoint on the setter for List.dataProvider and examine the data that's being set.
cliff.meyers
Yeah the problem was the xml data.
JohnMerlino