0 Replies Latest reply on May 9, 2010 10:12 PM by w.johnson

    AdvancedDataGrid not sizing to constraints top-left-bottom-right

    w.johnson

      I have a View (SkinnableContainer) that adds various components to the "contentGroup" of its skin. One of these components is an MXML AdvancedDataGrid (ADG) component. The data provider to the ADG is a customized wrapper that implements IList and wraps a matrix (for this example it is 100 rows x 60 columns.) MyADG horizontal and vertical scrollbars are enabled and, when rendered, MyADG adheres to its left, top and bottom constraints (i.e. the vertical size is correct). I expect the right constraint to also produce a margin of 30 but the ADG overflows and is about 1 1/2 screens wide. I've extracted the relevant chunks below and tried many variations on the parameterization. Maybe someone else can see the obvious.

       

      ------

      View

      addElement(component);

       

      ViewSkin

      <s:Group id="contentGroup" top="5" left="5" bottom="30" right="5" clipAndEnableScrolling="true"/>

       

       

      file: MyAdvancedDataGrid

       

      <mx:AdvancedDataGrid xmlns:fx="http://ns.adobe.com/mxml/2009"

      top="30" left="30" bottom="30" right="30"

      horizontalScrollPolicy="on" verticalScrollPolicy="on"                                                 allowMultipleSelection="true"

      editable="false"

      resizableColumns="false"

      sortableColumns="true"

      lockedColumnCount="1"

      sortExpertMode="true"

      >

       

       

      override public function set dataProvider(value:Object):void {

       

      if (value is MyDataProvider) {

      var dp:MyDataProvider = value as MyDataProvider;

       

      // create and install the grid column headers

       

      var gridColumns:Array = new Array(colHeadings.length);

      for (var j:int = 0; j < gridColumns.length; j++) {

      var colName:String = colHeadings[j];

       

      var gc:AdvancedDataGridColumn = new AdvancedDataGridColumn( colName );

      gc.labelFunction = numberLabelFunction;

      gc.width = 60;

      gc.sortCompareFunction = mySort;

       

      gridColumns[j] = gc;

      }

       

      columns = gridColumns;

       

      super.dataProvider = value;

      }

       

      else {

      super.dataProvider = value;

      }

      }

       

      ...