Alright Dan.. so we're going to solve this. After this much back-and-forth,
we've gotta make it work.
So here's the deal:
if you use my statement and squat is just XML, then you're almost there.
It should be something like this
<yourObject>
<name>GZAW08</name>
<otherProperty>value</otherProperty>
<etc... />
</yourObject>
With your variable squat, you can then access a specific property of it by
saying, for example, squat.name - that will give you the value. If you want it
as a string, you can also say squat.name.toString().
Just to clarify earlier, if you had
<yourObject name="GZAW08" etc.../>
then you would use squ...@name.
-Julian
________________________________
From: Dan Pride <[email protected]>
To: [email protected]
Sent: Sat, November 21, 2009 4:09:59 PM
Subject: Re: [flexcoders] Syntax Question
Yes I would think something this absurdly simple would be a single sentence
reply which I could cut and paste,... unfortunately not.
This statement with the variable uncast
var crapola = squaresGrid. selectedItem. NameCol;
returns as follows in the debugger
this
Center (@137ef0a1)
crapola XMLList (@1ce7c461)
[0] XML
<Name>
"GZAW08"
Your statement
var squat:XML = XML(squaresGrid. selectedItem) ;
returned just XML
Neither of the two options you stated worked.
It is the string "GZAW08" which I am trying to return.
I am ready to throw something, sorry to visit this on you.
--- On Sat, 11/21/09, Julian Alexander <wb...@ymail. com> wrote:
>From: Julian Alexander <wb...@ymail. com>
>Subject: Re: [flexcoders] Syntax Question
>To: flexcod...@yahoogro ups.com
>Date: Saturday, November 21, 2009, 2:08 PM
>
>
>>
>
>
>
> >
>
>
>>
>
>Why the heck do you need to re-cast as an XMLListCollection?
>
>This is a actually really simple...
>
>var squat:XML = XML(squaresGrid. selectedItem) ;
>var myValue:String = squ...@myproperty OR squat.myProperty (depending on if
>it's a node or attribute)
>
>It does work. I've done it hundreds of times. Don't know what you're doing
>wrong...
>
>-Julian
>
>
>
>
________________________________
From: Dan Pride <danielpride@ yahoo.com>
>To: flexcod...@yahoogro ups.com
>Sent: > Sat, November 21, 2009 11:43:34 AM
>Subject: Re: [flexcoders] Syntax Question
>
> >
>
>
>>
>
>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 <wb...@ymail. com> wrote:
>
>
>>From: Julian Alexander <wb...@ymail. com>
>>Subject: Re: [flexcoders] Syntax Question
>>To: flexcod...@yahoogro ups.com
>>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
>>>
>>>
>>>
>>
>>
>
>