does this work ?
No, it doesn't. I tried tracing the value and it looks like it's a pixel value, whereas verticalScrollPosition equalled the row index.
I tried something else:
This produces the same result as your code. In either case, if I try forcing the scroller to jump to a particular position:
scroller.viewport.verticalScrollPosition = myPosition;
The scroller returns to the top of the list.
Is verticalScrollPosition broken in Spark DataGrid? I'm tempted to switch back to MX DataGrid...
You will want to use:
Setting that should get you the behavior you want. In addition, you might want to check out the "myDataGrid.ensureCellIsVisible()" method which puts a cell fully into view.
You need to divide the pixel value you have got by the rowHeight of the grid, that will give the correct verticalScrollPosition.