When data is sent over the wire from a server, we have to guess whether
it is a single data object or an array of objects.  If we see an xml tag
twice we know it has to be an array, but if there is only one tag, we
assume it is an object.

 

You can simply test to see if the result is an ObjectProxy or an
Array/ArrayCollection and convert it to an array if needed.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Nicolas Boulet-Lavoie
Sent: Friday, March 23, 2007 11:04 AM
To: [email protected]
Subject: [flexcoders] ArrayCollection problem (binding to a Datagrid)

 

Hi,

When I try to bind an empty ArrayCollection or with only 1 item to a
Datagrid, I'm getting a runtime error (sorry it's in french but the
error number means something in this case):

TypeError: Error #1034: Echec de la contrainte de type : conversion de
mx.utils::[EMAIL PROTECTED] en mx.collections.ArrayCollection
impossible.

Here's the code I use :

private function handler(event:ResultEvent):void {
grilleTerrainsACDP = event.result.terrains.terrain;
}

And the "grilleTerrainsACDP" variable who's binded to my datagrid, as
the data provider, is declared this way:

[Bindable] public var grilleTerrainsACDP:ArrayCollection;

Any idea?

I use a ArrayCollection for ICursorView...

Thanks
Nicolas

 

Reply via email to