If horizontalScrollPolicy="off" (default), width is not ignored, but attempts are made to proportionally size all columns within the DG. At some point, things degenerate and the proportions are hosed.
If horizontalScrollPolicy="on", width should be honored. Width seems to work in this test, so maybe I don't understand what problem you're running into. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100 %" height="100 %"> <mx:DataGrid width="100%" height="100%" lockedColumnCount="2" horizontalScrollPolicy="on" variableRowHeight="true"> <mx:columns> <mx:DataGridColumn headerText="Start Date" dataField="TBD" width="200" resizable="false" /> <mx:DataGridColumn headerText="End Date" dataField="TBD" width="50" resizable="false" /> <mx:DataGridColumn headerText="Risk" dataField="TBD" width="50" /> <mx:DataGridColumn headerText="Risk 1" dataField="TBD" width="100" /> <mx:DataGridColumn headerText="Risk 2" dataField="TBD" width="150" /> <mx:DataGridColumn headerText="Risk 3" dataField="TBD" width="200" /> <mx:DataGridColumn headerText="Risk 4" dataField="TBD" width="50" /> <mx:DataGridColumn headerText="Risk 5" dataField="TBD" width="100" /> </mx:columns> </mx:DataGrid> </mx:Application> ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of gers32 Sent: Monday, October 22, 2007 11:25 PM To: [email protected] Subject: [flexcoders] Re: DataGrid: column width and horizontal scroll Yes, width is systematically ignored, that's why I set minWidth, which is better in the sense that the columns are wider (100), but its values are still ignored. Maybe there's an extra parameter (even from a superclass...) I need to set (like I did with horizontalScrollPolicy) for width to be taken into consideration? I forgot to mention I'm using Flex 2.0.1. via the Eclipse Flex Builder 2 plugin. Thanks for your help, Chris. --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Did you just try setting width and not minwidth? > > > > ________________________________ > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of gers32 > Sent: Monday, October 22, 2007 7:15 AM > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] DataGrid: column width and horizontal scroll > > > > Hi, > > I'm having a hard time figuring out how to set the column widths of a > DataGrid which is constrained inside its container (width="100%" > height="100%"), has two locked columns (lockedColumnCount="2"), and > which I force to scroll horizontally (horizontalScrollPolicy="on"). > > The DataGridColumn widths are systematically ignored (columns are all > scrunched up within the boundaries of the outside container) and they > take up their default width (100) if I set minWidth to a random value > (even if it's greater than 100!). > > I'd appreciate any help. Here's a piece of the code (there's not much > more...): > > <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > " width="100 %" > height="100 %"> > <mx:DataGrid width="100%" height="100%" > lockedColumnCount="2" horizontalScrollPolicy="on" > variableRowHeight="true"> > <mx:columns> > <mx:DataGridColumn headerText="Start Date" > dataField="TBD" minWidth="200" resizable="false" /> > <mx:DataGridColumn headerText="End Date" > dataField="TBD"minWidth="50" resizable="false" /> > <mx:DataGridColumn headerText="Risk" > dataField="TBD"minWidth="50" /> > ... > > Thanks, Chris. >

