Hi,

I'm working with Arash on this project.  Thanks for the suggestions
but even using these alternate methods for geting the selectedItem the
cast to a Position object still fails.

Our dataProvider is an ArrayCollection that is populated by a
ColdFusion query returned from a RemoteObject call.  The query rows
are from our positions table but flex is storing the rows as generic
'Objects' within the ArrayCollection.  Here is the line we use in our
RemoteObject result handler:

positions = event.result as ArrayCollection;  

Using the debugger we've been able to verify that the Objects in the
ArrayCollection do have the same public properties as our Position
value object.

So is it necessary to convert the query rows into Position objects
immediately when they come back from ColdFusion rather than casting
them after we get them out of the ArrayCollection?  How would this be
done exactly?

Adam

--- In [email protected], "ben.clinkinbeard"
<[EMAIL PROTECTED]> wrote:
>
> I assume your dataProvider is a collection of Position objects? Is it
> an ArrayCollection?
> 
> Try changing this line
> 
> selectedItem = event.currentTarget.dataProvider[selectedRow];
> 
> to this
> 
> selectedItem = event.currentTarget.dataProvider.getItemAt(selectedRow);
> 
> HTH,
> Ben
> 
> 
> --- In [email protected], "arashafrooze" <arash.afrooze@>
> wrote:
> >
> > Hi,
> > I'm a flex newbie, so please bear with me ...
> > I have an advanced datagrid with a change property that calls a
> > function passing it the event.
> > inside the function i retrieve the selected row and cast it as an
> > object. then i try to cast this object as, what i call a Position
> > object. Even though both objects are identical in properties, My
> > postion object does not get populated and is assigned NULL.
> > I'm pasting the code to my function. 
> > Any help is greatly appreciated.
> > 
> > 
> > public function updateSelectedPosition(event:Event):void
> > {
> >     var position:Position = new Position();
> >     var selectedItem:Object;
> >     var selectedRow:uint = event.target.selectedCells[0].rowIndex;
> >     selectedItem = event.currentTarget.dataProvider[selectedRow];
> >     position = selectedItem as Position;
> > }
> > 
> > Thank you all so very much in advance :D
> >
>


Reply via email to