This content has been marked as final. Show 3 replies
Your event.result contains an Array. The 'as' operator attempts to cast to the type you've specified (ArrayCollection) and if it can't returns null. So your app was binding null to the grid's dataProvider property. You could either do:
myData = new ArrayCollection(event.result as Array);
or change myData to type Array and do:
myData = event.result as Array;
I thought it was suppose to be
myData = event.lastResult;
is this only for java stuff?
The list-based classes (including DataGrid) do some massaging in the setter for dataProvider. If the assigned value is an Array it is wrapped automatically in an ArrayCollection. If it's already a ListCollectionView (ArrayCollection or XMLListCollection) it's used as is.
If the server returns data that's unpacked as an Array or ArrayCollection either would be directly assignable to the dataProvider property so a direct binding expression to a WebService operation's lastResult would just work. However, if having the local variable is useful it needs to be the proper type to store the result.