Flex 4.6 Mobile - Scrolling to the last added item in a dataGrid with variableRowHeight
- by user1305331
I'm trying to set the scroll vertical position of a spark dataGrid to show the items as I add them to the grid. I know you can set the scroll position like this:
dataGrid.scroller.viewport.verticalScrollPosition = itemPosition*rowHeight;
The problem is that the dataGrid have variableRowHeight, as each row word wraps their name labels, and I don't know how to get each row height. I though of getting the itemRenderer associated with every item as I add it to the grid, and keep the total row height value in a variable, but don't know how to achieve that.
Is there any way to set the scroll position of a dataGrid with variableRowHeight to show the last added item?