Assuming variableRowHeight="false":
ar numRows:int = Math.min(dg.dataProvider.length, desiredNumberOfRows); dg.height = numRows * dg.rowHeight + dg.viewMetrics.top + dg.viewMetrics.bottom; ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of abhi.sanoujam Sent: Saturday, October 20, 2007 4:30 PM To: [email protected] Subject: [flexcoders] how to intelligently change datagrid.height dynamically to adjust its rowCount Hi Guys, How can we can adjust the height of a datagrid dynamically so that it displays a user-specified number of rows?? e.g. If the dataProvider contains 100 elements and I want to adjust the height so that it displays me only 20 rows at a time (with scrollbars), how can i do it ?? Also if the number of rows (dataprovider.source.length) is less than 20 (the user specified number), the height of the datagrid is adjusted so that it takes up space for only those many rows (which is less than 20). Thanks for your help in advance!!!

