Palmer, Thanks, that really solves the problem! :) On 5/27/07, simonjpalmer <[EMAIL PROTECTED]> wrote:
write a method on your Customer and Product classes as follows: public function toString():String { return this.<insertyourinterestingStringpropertyhere>; } If you want more than that you can write a custom renderer for your classes and associate it with the datagrid columns. --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "André Rodrigues Pena" <[EMAIL PROTECTED]> wrote: > > Hi all, > > I'm using a DataGrid to the result of a RemoteObject. Each record is > an Object of type Sale that has this simplified definition: > > package beans > { > [Managed] > [RemoteClass(alias="com.beans.Sale")] > public class Sale { > public var id:int; > public var customer:Customer; > public var product:Product; > } > } > > Notice that customer and product are complex types, that also have > correspondent back-end classes. > > I manage to retrieve data successfully from the server. For instance, > if I handle the RO result like this: > > public function handleResult(event:Object):void { > sales = ICollectionView(event.result); > var a:Sale = sales[0]; > Alert.show(String(a.product.name)); > } > > the product "name" is displayed properly, what proves that the data > was retrieved. > > Although when I try to populate de DataGrid, I can't set a > DataGridColumn to display the property "name" within the property > "product" from the data provider. The code is the following: > > <mx:DataGrid id="datagrid" dataProvider="{sales}" width="100%" height="100%"> > <mx:columns> > <mx:DataGridColumn dataField="id" headerText="Id"/> > <mx:DataGridColumn dataField="product.name" headerText="Product"/> > <mx:DataGridColumn dataField="customer.name" headerText="Customer"/> > </mx:columns> > </mx:DataGrid> > > Only the simple attribute "id" is properly displayed in the DataGrid > > Why? What can I do? > > Thanks! > > > -- > André Rodrigues Pena > > LOCUS > www.locus.com.br >
-- André Rodrigues Pena LOCUS www.locus.com.br Blog www.techbreak.org