I tried to limit the size of the AdvancedDataGrid to its rows. Currently I am using variableRowHeight to true and at the run time setting the itemRenderer's height.
Hence every row has different height. But I found that the logic behind the calculation of Grid's height is plain and simple - measure the height of the first row, then multiply it with the number of rows. Please correct me if I am wrong here
I did some POC on the issue and found that during the calculateRowHeight event -> it calculates the individual row height but somewhere down the line it is only multiplying the rowCount with the first row's height. Instead it should calculate every row and should sum up the height.
Please suggest a way to overcome this.
PS: I tried below options: 1. rowCount = arrayCollection.length 2. dataGrid.height = dataGrid.measureHeightOfItems(0, arrayCollection.length)+ dataGrid.headerHeight
The following code can be used in the measure overriden method of the extended AdvancedDataGrid:
override protected function measure():void
{
super.measure();
if(this.dataProvider != null && this.dataProvider.length > 0)
{
this.measuredHeight = this.measureHeightOfItems(0, dataProvider.length);
}
}
This will calculate the height of all the rows and will set the datagrid height accordingly.