I'd have to double check, but I think it was 1 in Flex 2 and may be 0 in Flex 3
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Sent: Friday, February 08, 2008 8:27 AM To: [email protected] Subject: [flexcoders] Re: Display Custom ItemRenderer based on previous value in List Thanks for that. Is the documentation wrong about the rowIndex offset starting at one or am I not understanding it correctly? - Kevin --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Add verticalScrollPosition to get the DP index > > > > ________________________________ > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of Kevin > Sent: Thursday, February 07, 2008 2:58 AM > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Re: Display Custom ItemRenderer based on previous > value in List > > > > Maybe I am just being dense, but I can't figure out how rowIndex helps > me since it is relative to the display on the screen and what i really > need is to know the index of the current item relative to it's > position in the data provider. > > For example, if I have 3 rows displayed (but 20 items in the > ArrayCollection) and I get a rowIndex of 2, all that tells me is that > this item is in the third row on the screen. However, that doesn't > mean that it is the third item in the dataProvider so this, > > _listData.owner.dataProvider.getItemAt(listData.rowIndex - 1) would > not necessarily lead me to the previous item. > > Of course, I could scan through the dataProvider each time to try to > get the index of the current data item, but that seems extremely > inefficient. > > BTW, I also noticed that the docs refer to the first item in the list > as index 1, but in my testing it seemed like this is a zero based > index. Am I misreading the docs or are they wrong? > > "rowIndex --- The index of the row of the DataGrid, List, or Tree > control relative to the currently visible rows of the control, where > the first row is at an index of 1. For example, you click on an item > in the control and rowIndex is set to 3. You then scroll the control > to change the row's position in the visible rows of the control, and > then click on the same row as before. The rowIndex now contains a > different value corresponding to the new index of the row in the > currently visible rows." > > - Kevin > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > , "Eric Cancil" <ecancil@> wrote: > > > > listData.rowIndex = indispensable > > > > On Feb 6, 2008 7:16 PM, Alex Harui <aharui@> wrote: > > > > > If you assume Arrays, and you can efficiently find the index, > then you > > > can use getItemAt to get the previous item. listData.rowIndex > might be > > > useful > > > > > > > > > ------------------------------ > > > > > > *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 *Kevin > > > *Sent:* Wednesday, February 06, 2008 1:24 PM > > > *To:* [email protected] <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > > *Subject:* [flexcoders] Display Custom ItemRenderer based on > previous > > > value in List > > > > > > > > > > > > I am trying to solve a certain design problem and am not sure how to > > > approach this. > > > > > > I have a List control which displays data using a custom > ItemRenderer. > > > I currently listen for a dataChange event and set different > > > properties of the ItemRenderer based on the data that is being set. > > > That all works fine. (although it could use some refactoring for > > > performance). > > > > > > However, I now want to set some additional properties based on how > > > this data compares to the data of the previous item in the list's > > > dataProvider. > > > > > > I am struggling to find the best way to do this. I can get access to > > > the DataProvider though this.owner.dataProvider, but then I would > need > > > to set up a new cursor, find the current item in the list and then > > > movePrevious() to compare to the previous item. Of course this would > > > have to happen each time they renderer was created for a new item in > > > the list. > > > > > > Can anyone think of another more efficient way to achieve this? > > > > > > Along the same lines, it would also be nice to create separators in > > > List controls, but I haven't figured a way to do this either. For > > > example, if you are displaying a list of 20 scheduled events, it > would > > > be nice to be able to create separator for each different day that > the > > > events happen on. I am guessing I may have to look into extending > the > > > List component for this. > > > > > > - Kevin > > > > > > > > > > > >

