11 Replies Latest reply on Jun 17, 2009 11:28 PM by leybniz

    Scrollbar bug in Datagrid component ?

    cho7

      Hi,

       

      I'm having a strange behaviour of my datagrid component in my app. If I add too many columns (ie. 100 columns) at the same time, its scrollbar appear (it's ok), but the scrollbar of the parent component (ie. a panel) appears too !

       

      Whereas if I had, for example 1 column, then 99 just after, it works. The panel doesn't show its scrollbar.

       

       

      I wrote a sample app to reproduce the bug :

       

      Steps :

      1/ add one column, then another on. OK

      2/ reset, add 1000 columns -> overflow, the panel scrollbar is activated

      3/ reset, add 1, then 999 -> OK

       

      The limit of the overflow seems to be the size of the datagrid. As long as she has enough space, I can initialize the grid with as many column as want. If it did not have enough space, I have to initialize first with 1 column, then add the rest.

       

      Sorry for my english, I'm french

       

       

      And thanks for your help

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application

       

      xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()"

      >

       

       

      <mx:Script>

      <![CDATA[

       

       

      import

      mx.controls.dataGridClasses.DataGridColumn;

       

       

      import

      mx.collections.ArrayCollection;

       

       

      private var

      columns:ArrayCollection

       

       

       

      private function init():void

      {

      columns =

       

      new

      ArrayCollection();

      grid.columns =

       

      new

      Array();

      }

       

       

       

      private var

      cpt:int=0;

       

       

      private function addColumns():void

      {

       

       

       

      for (var

      i:int = 0; i<Number(nb.text); i++){

      cpt++;

       

       

      var col:DataGridColumn = new

      DataGridColumn(String(cpt));

      columns.addItem(col);

       

      }

      grid.columns = columns.toArray();

       

      }

       

       

       

      private function clear():void

      {

      cpt=0;

      columns =

       

      new

      ArrayCollection();

      grid.columns =

       

      new

      Array();

      }

      ]]>

       

       

      </mx:Script>

       

       

       

      <mx:TextInput id="nb" text="1"

      />

       

       

      <mx:Button label="Add" click="addColumns()"

      />

       

       

      <mx:Button label="Reset" click="clear()"

      />

       

       

      <mx:Panel title="Datagrid test" width="50%"

      >

       

       

      <mx:DataGrid id="grid" width="100%" horizontalScrollPolicy="auto"/>

       

       

      </mx:Panel>

       

      </mx:Application>