What's happening is that the second and third panels don't get sized
right away and they size the DG to something small which squishes the
columns.  Try setting a minWidth on the DG to as large a number as
possible.

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of lytvynyuk
Sent: Thursday, January 03, 2008 12:51 PM
To: [email protected]
Subject: [flexcomponents] Generated DataGrid column sizes problem...

 

Here is the piece of code:
Which generates 3 tabs with DG within, problem is 2 hidden tabs ignores
sizes I set.
Is there any way to set properly column sizes?

In Application please click button to see.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
    <mx:Script>
        <![CDATA[
            import mx.controls.dataGridClasses.DataGridColumn;
            import mx.controls.DataGrid;
            import mx.containers.Canvas;            
            private function populate():void {
                for(var i:int = 0; i < 3; i++ ) {
                    var canvas:Canvas = new Canvas();
                    var grid:DataGrid = new DataGrid();
                    grid.selectable = false;
                    canvas.label = "Tab";
                    canvas.percentHeight = 100;
               &! nbsp;    canvas.percentWidth = 100;
 &n! bsp; &nb sp;                canvas.addChild(grid);
                    
                    grid.percentHeight = 100;
                    grid.percentWidth = 100;
                    grid.variableRowHeight = false;
                    
                    var columns:Array = new Array(new DataGridColumn(),
new DataGridColumn(), new DataGridColumn());
                   !  var c1:DataGridColumn =
DataGridColumn(columns[0]);
                    c1.dataField = "device_types";
                    c1.headerText = "Field1";
                    c1.width=100;
                    var c2:DataGridColumn = DataGridColumn(columns[1]);
                    c2.headerText = "Field2";
                    c2.dataField = "device_types";
                    c2.wordWrap = true;
  ! ;             &nb! sp;  ;   var c3:DataGridColumn =
DataGridColumn(columns[2]);
                    c3.headerText = "Field3";
                    c3.width = 100;
                    c3.dataField = "device_types";
                    
                    grid.columns = columns;
                    
                    navigator.addChild(canvas);
                }
 !            }            
        ]]>
    </mx:Script>
    <mx:TabNavigator id="navigator" width="100%" height="100%">
    </mx:TabNavigator>
    <mx:Button label="Button" click="populate()" bottom="10" left="10"/>
</mx:Application> 

 

Reply via email to