Ryan H
Ryan H

Reputation: 1914

Sizing Flex DataGridColumns(Dynamic number)

I have a DataGrid that has between 4-10 columns. I want the columns to be of width '50'. I have already set the width attribute in MXML. I am using "colName.hide = true" to hide various columns depending on whether I have data. I find that my columns expand when I have less columns. Is there a way to set the max width of a column or force it to keep the same width?

Upvotes: 0

Views: 753

Answers (2)

Chris Klepeis
Chris Klepeis

Reputation: 9973

Why not just resize the width of the datagrid itself to 50 * amtOfCols when columns are hidden and shown?

Upvotes: 2

Vugluskr
Vugluskr

Reputation: 1436

You have to leave one column with undefined width - it will stretch when parent (grid) will be resized.

Or, you should recalculate and apply width of the greed dynamically

Upvotes: 1

Related Questions