Can you please explain your use case for needing a reference to an item renderer? As Tracy said, "You are probably making a mistake". Item renderers are intended to render data items, not to be manipulated directly as visual components.
Gordon Smith Adobe Flex SDK Team ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Marcin Glowacki Sent: Monday, April 28, 2008 1:37 PM To: [email protected] Subject: [flexcoders] Re: How to get the reference to an item renderer given item index in dataProvide Thanks, I will give it a shut --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > You are probably making a mistake, but, from the docs: > > > > indexToItemRenderer > > () > > method > > > > public function indexToItemRenderer(index:int > <http://127.0.0.1:58469/help/topic/com.adobe.flexbuilder.help/langref/in <http://127.0.0.1:58469/help/topic/com.adobe.flexbuilder.help/langref/in > > t.html> ):IListItemRenderer > <http://127.0.0.1:58469/help/topic/com.adobe.flexbuilder.help/langref/mx <http://127.0.0.1:58469/help/topic/com.adobe.flexbuilder.help/langref/mx > > /controls/listClasses/IListItemRenderer.html> > > Get an item renderer for the index of an item in the data provider, if > one exists. Since item renderers only exist for items within the set of > viewable rows items, you cannot use this method for items that are not > visible. > > Parameters > > > > index:int > <http://127.0.0.1:58469/help/topic/com.adobe.flexbuilder.help/langref/in <http://127.0.0.1:58469/help/topic/com.adobe.flexbuilder.help/langref/in > > t.html> - The offset into the data provider for an item > > Returns > > > > IListItemRenderer > <http://127.0.0.1:58469/help/topic/com.adobe.flexbuilder.help/langref/mx <http://127.0.0.1:58469/help/topic/com.adobe.flexbuilder.help/langref/mx > > /controls/listClasses/IListItemRenderer.html> - The item renderer that > is displaying the item, or null if the item is not currently displayed > > > > Tracy > > > > ________________________________ > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of Marcin Glowacki > Sent: Monday, April 28, 2008 11:31 AM > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Re: How to get the reference to an item renderer > given item index in dataProvide > > > > OK, thanks for your input. > > However, I would appreciate any hints on how I could write a method in > MyDataGrid that will return reference to itemRenderer or itemEditor or > null at any given point in time. > > If a given row is not displayed on the screen this method should > return null, otherwise itemRenderer or itemEditor. > > protected function getItemRendererByPosition(dateProviderIndex:int, > columnIndex:int):IDataRenderer > { > // go through all item renderers and return the one I need > // where are the renderers stored? any protected member? > // how can you tell current position of an item renderer? > } > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > , "Tracy Spratt" <tspratt@> wrote: > > > > You cannot do that. > > > > > > > > Item renderers are recycled. Only the visible rows are > > instantiated(plus a few buffers) So if row 5 is not visible, it does > > not exist, and you cannot reference it. > > > > > > > > In almost all cases, work should be done on the underlying > dataProvider. > > > > > > > > Search archives or google for: itemRenderer recycle > > > > > > > > Tracy > > > > > > > > ________________________________ > > > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > ] On > > Behalf Of Marcin Glowacki > > Sent: Sunday, April 27, 2008 3:21 PM > > To: [email protected] <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > > Subject: [flexcoders] How to get the reference to an item renderer > given > > item index in dataProvider? > > > > > > > > In Flex 3 DataGrid, how to get the reference to item renderer given > > item index in dataProvider and column number? > > I am extending DataGrid, and I need to access it in MyDataGrid. > > > > Lets say I want itemRenderer for item in dataProvider at index 5 and > > column 2. > > > > And > > > > how to get the array of all itemRenderers and/or itemEditor for a > > given index of an item in dataProvider? > > >

