Looking at you code it appears you are just missing a labelFunction on
the resource.num column. You cannot access nested object properties
with just the column name. Try this:

public function resourceNumLabel( data : Object ) : String {
           return data.resource.num;
}

Add the above function as the labelFunction property of the column.

<mx:DataGridColumn columnName="resource.num"
labelFunction="resourceNumLabel" headerText="A"/>

Michael McKellip

On 6/14/05, Kevin Ewok <[EMAIL PROTECTED]> wrote:
> List,
>   I have spent now a day and half trying to debug this issue and I
> still cannot get it to work. My superiors want to go to a JSP model if
> I can't get this working, and I know it's something stupid I missing.
> 
> Anyway, I cannot get my datagrid values to display the values of
> nested objects. I saw postings involving overriding the AS
> constructor, but still no luck. To give you an idea, the first value
> of my datagrid below actually returns "[object Object]", so I know
> Flex has a handle on it. But the 2nd column of my datagrid (where I
> try to get the attribute from that object), always returns an empty
> value.
> 
> <mx:DataGrid id="dg" dataProvider="{myRemoteObj.getAll.result}">
> <mx:columns>
> <mx:Array>
> <mx:DataGridColumn columnName="resource" headerText="r"
> labelFunction="getIt" />
> <mx:DataGridColumn columnName="resource.num" headerText="A"/>
>   </mx:Array>
>  </mx:columns>
> </mx:DataGrid>
> 
> Below are my 2 AS classes which mirror my Java classes. When I debug
> the labelFunction method on my first column above, I can see that the
> values are there in my nested object (by exploding the 'item'
> attribute). When I call set "item.getResource().getNum()" toa local
> var on that item, it always returns undefined....in fact, so does
> item.getResource();. It's just really confusing. I'm running this on
> Jboss.
> 
> thanks in advance.
> 
> /** Parent (top-level) Object*/
> class com.Parent extends Object {
> 
> public function Parent(){}
> public static var regClass = Object.registerClass
> ("com.Parent",com.Parent);
> 
> var resource : com.Resource;
> function getResource() : com.Resource { return resource; }
> 
> function setResource(arg : com.ecarey.ces.model.Resource) : Void {
> resource = arg; }
> 
> /** Nested Object */
> class com.Resource extends Object {
> 
> public function Resource(){}
> 
> public static var regClass = Object.registerClass
> ("com.Resource",com.Resource);
> var num:String;  //also tried var num:String = new String();
> function getNum() : String { return num ; }
> function setNum(arg : String) : Void { num = arg; }
> }
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
>


 
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/
 



Reply via email to