0
votes

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?

1

1 Answers

0
votes

After you set your dataprovider, you could do something like

dg.validateNow();
dg.verticalScrollPosition=dg.grid.contentHeight+dg.grid.height;