Given that renderers recycle, if you have a ComboBox in a renderer, you usually 
need to store its selectedIndex somewhere (in the data, on the column, in some 
map).  If you're calculating it on the fly, that might slow scrolling so you 
should consider storing it somewhere.

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Howard 
Fore
Sent: Friday, August 29, 2008 10:30 AM
To: [email protected]
Subject: Re: [flexcoders] Re: How to get selectedIndex from itemRenderer

Right, but I'm not looking for the index of the item shown on the DataGrid but 
the index of the selected item in the itemRenderer for column 2 in the 
DataGrid. The dataField for that column says "2", the ItemRenderer uses a 
labelFunction to reach in to a different ArrayCollection and pull out a 
meaningful name, "Foo". The DataGrid is sorted by the arrayCollection so the 
original index value of the selectedItem in the DataProvider doesn't do me much 
good.

I guess I could pass the ArrayCollection to the popup and have it duplicate the 
same labelFunction I jsut thought there might be a way to ask the ItemRenderer 
for the DataGrid's column for the SelectedIndex (in the renderer, not the 
DataGrid).
On Fri, Aug 29, 2008 at 11:05 AM, Amy <[EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>> wrote:
--- In [email protected]<mailto:[email protected]>, "Howard 
Fore" <[EMAIL PROTECTED]>
wrote:
>
> Hey,
>
> I've got a DataGrid that's using an inline itemRenderer of a
ComboBox for
> one of the DataGridColumns. How can I get the selectedIndex of that
> ComboBox? There's a default sort on the DataGrid and the DataGrid is
> user-sortable as well, so the selectedIndex isn't going to mirror
the index
> of the selected row in the DataGrid. I need it to pass to a
ComboBox in a
> popup that will appear when the user double clicks it.
If your DataProvider is XML, then yourDG.selectedItem.childIndex()
should do it.  If not, ArrayCollection has getItemIndex().

HTH;

Amy


------------------------------------

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
Groups Links





--
Howard Fore, [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>
"The universe tends toward maximum irony. Don't push it." - Jeff Atwood

Reply via email to