How to determine if a DataGrid or List has ScrollBars
There are occasions when you need to programmatically determine if a List or DataGrid has enough rows to require ScrollBars. If your DataGrid, for example, does not have an explicit rowCount or height specified, then it’s not as easy as looking at its data provider.
The easiest way I’ve found it to use the “maxVerticalScrollPosition” property, which the Flex 3 Language Reference describes as:
“The maximum value for the verticalScrollPosition property. Note that this is not the height of the content because the maxVerticalScrollPosition property contains the height of the content minus the height of the displayable area.”
So if the the maxVerticalScrollPosition is greater than zero, then scrollbars must be available.
// is scrollable
}else{
// not scrollable
}
If anybody know of an easier or more efficient way of determine if a List has ScrollBars, please let me know.
Tags: DataGrid, List, maxVerticalScrollPosition, scrollbars