Thanks for the response.
Its an ArrayCollection of XML objects.

var squat:XMLList = squaresGrid.selectedItem.NameCol;
will trace as an XML List but I can not seem to get the list
to then recast as an XMLListCollection so I can get at it.
   
Thanks
Dan

--- On Sat, 11/21/09, Julian Alexander <[email protected]> wrote:

From: Julian Alexander <[email protected]>
Subject: Re: [flexcoders] Syntax Question
To: [email protected]
Date: Saturday, November 21, 2009, 11:14 AM







 



  


    
      
      
      Dan,

The problem (I assume) is that the object you're getitng back isn't XML.  I was 
using that as an example, but when you use the "as" operator if the object 
isn't that type it will always return null.

What is your data provider?  Is it an array of objects? XML? It all depends on 
what you're doing.  Either way, it's based on a list.  Getting the selected 
item will give you a generic "object" that you need to cast to whichever data 
type (actually, you don't have to but it's nicer) at which point you have all 
of the properties accessible and you can grab the same property that the first 
column is bound to.

-Julian

From: Dan Pride <danielpride@ yahoo.com>
To: flexcod...@yahoogro ups.com
Sent: Sat, November 21, 2009 7:42:28 AM
Subject: Re: [flexcoders] Syntax Question








 



    
      
      
      Julian... Apparently you are wrong?

When I do it with an untyped var I get an object with an XMLList for each grid 
column
   var squat = dataGrid.selectedIt em;

This
var myValue:XML = dataGrid.selectedIt em as XML;
returns null for myValue

Why is it such Rocket Science to get the first value in a column?
Very frustrating for something that should be so simple.

Thanks for the help
Dan

--- On Fri, 11/20/09, Julian Alexander <wb...@ymail. com> wrote:

From: Julian Alexander <wb...@ymail. com>
Subject: Re:
 [flexcoders] Syntax Question
To: flexcod...@yahoogro ups.com
Date: Friday, November 20, 2009, 10:53 PM







 



    
      
      
      You can't access the value from the column name - getting the selected 
value will give you the entire row that the datagrid is displaying from which 
you can get the value you're looking for.  In other words, if you have an 
XMLList as your dataProvider, you can do something like:

var myValue:XML = dataGrid.selectedIt em as XML;
var myName:String = myval...@name.

Make sense?

-Julian

From: Dan Pride
 <danielpride@ yahoo.com>
To: flexcod...@yahoogro ups.com
Sent: Fri, November 20, 2009 9:43:33 PM
Subject: [flexcoders] Syntax Question








 



    
      
      
      On Creation complete I am filling a datagrid and I want to select the 
first value listed from the Name Column (NameCol)



What is the syntax?

dataGrid.selectedIn dex = 0;

Value = dataGrid.selectedIt em.NameCol;



Does not work. why not?



Thanks

Dan





    
     









      

    
     



 







      

    
     











      

    
     

    
    


 



  






      

Reply via email to