rowIndex refers to the index of the item in the viewable area within the datagrid; not as the docs say the index of the item in the dataprovider. -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dustin Mercer Sent: 30 November 2006 22:39 To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] {data} current index You could also look at the listData property on the renderer (if it implements IDropInListItemRenderer, which it should). It has the rowIndex and columnIndex properties on it. For some reason listData is not bindable, but if your renderer is built in AS, you won't need the binding, if it's mxml, then you can use the creationComplete event to compute the itemIndex. For a TileList it might be a bit complex though, since you need to do a little math to find out what the item's index is. Here is some pseudo code for that. var itemIndex : int = (listData.owner.columnCount * listData.rowIndex) + (listData.columnIndex + 1) What Lach suggested below is the easiest way and fastest way to get this going. If you need the index to be dynamic, for instance if you need to do any filtering or sorting and want the index to be re-evaluated, listData is the way to go. Dustin Mercer _____
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Lachlan Cotter Sent: Thursday, November 30, 2006 12:54 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] {data} current index Hi Alex, Item renderers aren't really aware of the wider context in which they are show (i.e. as one item in a collection). They are only concerned with how to render the particular data object that is passed to them. If you want to render some kind of index number on the view, your best bet is probably to incorporate it in the model somehow. That is, each item in your collection should have an index property which is set to equal its position in the collection. Then you can say <mx:Text text="{data.index}"/> Cheers, Lach On 30/11/2006, at 2:22 AM, Alex wrote: Hi, I have an application that uses a custom component as a renderItem in a TileList, retrieving a list of data from XML as the dataProvider. How can I retrieve the current index of the item within my custom component? I can retrieve the data using {data}, but how would I retrieve the index of the item as it is being added in the actual TileList?