tags:

views:

33

answers:

2

Is it possible for a Flex List to adjust its height automatically for the number of rows it's displaying? The problem I'm having is that the List renders taller than the number rows. The number of rows is dynamic so I'd like the List to automatically adjust its height based on its content. I've tried setting height="100%" which doesn't help.

A: 

If your items all render at the same height, you could bind the height of your list to the number of rows * the item renderer height.

Alternatively, if you are using Flex 4, you can create new skin for your List based on the existing List skin, but remove the Scroller that wraps the DataGroup and make the height of the DataGroup 100%.

Hope that helps.

Wade Mueller
Unfortunately each row's height is different.
Steve Kuo
Are you using a Flex 4 (spark) List? If so, you may want to try modifying the default skin as I describe above. Also, you may need to change useVirtualLayout to false.
Wade Mueller
I thought that the Flex 4 List had this behavior out of the box.
James Ward
A: 

It appears that List defaults to fixed row height. Setting variableRowHeight to true fixed it.

variableRowHeight="true"
Steve Kuo