You should be using events...

<mx:DataGrid id="headlinesDG"
dataProvider="{MyModel.getInstance().adminARCHeadlines}"
itemClick="selectedHeadline(event)" ...
...
</mx:DataGrid>

private function selectedHeadline(event:ListEvent):void {
currentVO = event.target.selectedItem as headlineVO;
}



--- In flexcoders@yahoogroups.com, Greg Morphis <gmorp...@...> wrote:
>
> I have a vo headlineVO that has the following variables
> headline_id:Number
> headline:String
> effdate:Date
> endeffdate:Date
> actionuser:String
> actiondate:Date
> I have a cfc that returns an ArrayCollection of beans, each bean has
> the above variables too.
> I can populate a datagrid with this data and it shows fine.
> I'm trying to populate a new vo (currentVO) when the user selects a
> row and hits "edit".
> The new VO shows as being null in the debugger.
> This is what my code looks like
>
> <mx:DataGrid id="headlinesDG"
> dataProvider="{MyModel.getInstance().adminARCHeadlines}"
> click="selectedHeadline" ...
> ...
> </mx:DataGrid>
>
> above I have a function
> private function selectedHeadline():void {
> currentVO = headlinesDG.selectedItem as headlineVO;
> }
>
> and for the editButton.click I have another function that just Alert
> the currentVO.headline;
>
> I get a null object reference when I click on the edit Button.
> If I put a breakpoint above the Alert I can see that currentVO is
> null, how can I assign that selected row to my vo?
> Can anyone offer suggestions or things I should check?
>
> Thanks in advance!
>

Reply via email to