--- In [email protected], "kaleb_pederson" <[EMAIL PROTECTED]> wrote: > > What is the proper way to get the rowIndex into my dataProvider when > using a context menu? > > Here's a few things that I tried and why they didn't work: > > 1) Cast event.mouseTarget to the DataGridItemRenderer and used > listData.rowIndex property. This doesn't work because rowIndex is > really the index of the row currently being displayed and is, > therefore, wrong once you've scrolled down. > > 2) Cast event.mouseTarget to the DataGridItemRender and then used it's > data property to access the item directly. This (and #1 above) > doesn't work because I also use other or custom item renderers. > > 3) Use the DataGrid's contextMenuY property, the height property and > the size of my list in order to calculate the position. I believe I > can get this to work ... IF I assume that the row height distribution > is normal AND that there are no margins, borders, etc. This seems > very brittle. > > 4) [Untested] I suppose I could use the contextMenuY as above, but > then use the ListRowInfo array to make sure to include margins, etc. > but I'm still not positive if the contextMenuY does or does not > include any special margins, styles, etc. > > So, I still haven't found a good way to do it. Suggestions very > welcome.
I threw this example together yesterday to answer a question on another forum You might find it helpful, though it isn't specific to your situation: http://www.magnoliamultimedia.com/flex_examples/LineNumExample

