1 person found this helpful
As long as there is room for the other columns to shrink, resizable=false
should lock the width of the one column.
This seems to keep the initial ((column's declared width / total declared width of all columns) * data grid width) no matter what you do to the data grid afterwards, but the initial column width is variable according to the initial width of the data grid and the initial sum of the declared widths of the columns. Because of this, if you're using multiple data grids on the same page which are different widths to begin with, a column which has the same width set is a different size in each of them.
I've attached a screenshot to show what I mean (with data removed). In this screenshot, the width of all three + columns is identical, and all three of them have resizable set to false. The sum of the widths of the columns in the top left and bottom grids are identical. The size of the + column varies between the grids, which I would assume is because the grids have different initial widths.
Is there any way to specify the width absolutely (without going through the above formula) in the case that the sum of the column widths is greater than the width of the data grid? I get the feeling that there might not be, at least not without reprogramming DataGrid (or one of its associated classes).
EDIT: I'm going to have to withdraw this question. I set the horizontalScrollPolicy to "on" to test whether the sizing was basically correct, and have gotten behavior so weird that there seems to be some kind of major sizing bug, either in my code (probably more likely) or in the Flex library. I'll mark this answered for now, since there are clearly other problems than just the initial sizing, as I had previously assumed, and even if the previous answer was right, I wouldn't be able to recognize it.
Screenshot.png 8.3 K
Columns default to having minWidth=50, I think. In theory, if
resizable=false on a column it will have its size honored if it is greater
than its minWidth and there is enough room left for all other columns to
shrink to their minWidths and still fit. Only if there isn't enough room to
fit non-resizable columns plus the minWidths of resizable columns do we
start shaving everybody. Or maybe there's a bug in that algorithm.