Given some string, call the DG's measureText method to get the pixel size.
If horizontalScrollPolicy="on", the width should be honored. If "auto" things are proportional so I would try making it non-resizable until creationComplete then flip it to be resizable. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of handitan Sent: Wednesday, November 07, 2007 5:51 PM To: [email protected] Subject: [flexcoders] Flex 2.0.1: DataGridColumn width expands to the longest string Hi all, I know that this issue has been brought several times in this forum but as far as I read there's no solution to this yet. Basically, there are 2 things that I want to do: 1. I would like the dataGridColumn width to expand to its longest string. 2. This should only happen when the grid is displayed on the 1st time. Way that I was doing to tackle the issue: - I made a custom DataGridColumn that enables me to calculate the longest string length (fyi,I don't know how to determine the pixel size so I just use some number <-- if you know how to get the pixel size, please let me know) by inspecting the string whenever itemToLabel function is called and assign that value to width. Unfortunately, the result is very messy. The column is not just rendering correctly and you cannot resize the column anymore. Anyway, I would like to get some ideas on how you all would take this issue. Thank you for reading!

