I wonder if this is the issue with object references not getting
compiled into the swf?

Create a dummy variable with the object as its type:
var dummy:Parent;
var dummy2:regClass;

Also, you will definitely need labelFunction everywhere.  columnName
will only work for first level properties of item, and you can't "dot
down".  columnName and labelFunction are mutually exclusive.

Can you expose the values you want as properties, maybe with getter
methods, rather than as plain methods?  Just thinking.

Tracy

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Kevin Ewok
Sent: Tuesday, June 14, 2005 3:14 PM
To: [email protected]
Subject: [flexcoders] Datagrid not populating values.

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