1 Reply Latest reply on Feb 1, 2011 9:26 AM by Flex harUI

    Calculate accurate datagrid height with variableRowHeight and without any empty row

    anshusaini

      hi ,

      how can i calculate accurate datagrid height with variableRowHeight="true" and without getting any empty row.

       

      Currently i am calculating datagrid height on updateComplete event of datagrid as follows:

                        

      public function onUpdateComplete() : void

      {

      this.datagrid.headerHeight=50;

      datagrid.height= datagrid.measureHeightOfItems(0, this.datagrid.dataprovider.length)+this.datagrid.headerHeight;

      }

       

       

      with following datagrid properties:

       

      <mx:DataGrid 

      dataProvider="{dataArrayCollection}" width="100%" rowCount="{dataArrayCollection.length}"

      id="datagrid" updateComplete="onUpdateComplete()" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0"

      fontSize="12" wordWrap="true" variableRowHeight="true" verticalScrollPolicy="off" >

       

       

      With this approach the issue is, i am getting scrollbar on datagrid's container. I want scrollbar for datagrid instead of its container so that i can have only rows to be scrollable and not the header. Also, if i set verticalScrollPolicy of datagrid as "auto", i get empty rows.

       

      So,is there any way to have datagrid with following properties:

      • variable row height

      • no empty rows

      • word wrap for headers as well as for rows

      • Scrollbar for grid i.e. header should remain fix ,only rows should be scrollable

      • no horizontal scrollbar

       

       

      TIA