I have a Flex 4, mx:DataGrid with the following (pertinent) properties set:
width="100%"
horizontalScrollPolicy="off"
I have the minWidth
set on all of the DataGridColumns
and the width set on one of them. If I simply maximize/minimize the display (in browser or stand-alone flash player) of the application, the columns scale up and down nicely. But if you grab the edge of the application and drag it to make it bigger, only one column grows really big. When you drag the size down again, the one column remains big, but all of the other columns get squished way down.
Is this a bug in the Flex DataGrid, or am I just missing a key property (or properties on the datagrid columns) to set, to make all columns grow and shrink when you drag-enlarge the app?
Solved this problem as follows:
in creationComplete add
Try capturing the event, setting the horizontalScrollPolicy to On, letting Flex resize the columns itself, then setting horizontalScrollPolicy back to Off
It is an unpleasant anomaly, if not an actual bug, in the way Flex does datagrids. In Adobe's defense, figuring out how to resize all the columns appears not to be a trivial task.
The way I've always handled this is to make a dummy column at the end, with a minWidth of 4 and no width specification. Then that becomes the "expandable column" that takes up the slack. Then I make sure to allow the rest of the columns enough room to display their data and their header renderers from the start by giving each a minWidth and a width. The only time I have problems is if there are too many columns to display in the space allowed, in which case you get a horizontal scrollbar and all (or most) bets are off.