0 Replies Latest reply on Apr 27, 2007 1:07 PM by BellCurve

    Dynamicly resizing the DataGrid control

      I'm trying to get the height of my DataGrid to resize based on the number of items in the grid.

      Any help on this is apprecaiated.

      I'm trying to resize a datagrid based on its cell contents. So far I've tried the following approach with several several different events, but I'm not having any luck.

      <?xml version="1.0" encoding="iso-8859-1"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:local="*">
      private var example:XML =

      private var dgsize:Number;

      private function sizeGrid(count:Number, height:Number):Number
      count = myDataGrid.rowCount;
      height = myDataGrid.rowHeight;
      trace("count: " + count);
      trace("height: " + height);
      dgsize = (count * height) /2;
      trace (dgsize);
      return dgsize;


      <mx:DataGrid id="myDataGrid" height="433"
      variableRowHeight="false" enabled="true" width="800" creationComplete="{sizeGrid(myDataGrid.rowCount,myDataGrid.rowHeight)}">
      <mx:DataGridColumn headerText="Row Count" dataField="value"/>