Sometimes there’s just too many columns in a grid to display sensibly in the restricted view window you need to design for. When this occurs you have no choice but to add scrolling to the grid so the user can get to the extra data if needed.

I had to do this today and found that things did not go quite to plan.

Adding a scrollbar is as simple as adding a scroll policy to your datagrid via the horizontalScrollPolicy property. So your opening tag would look a bit like this:

[cc lang="actionscript" lines="25"]

[/cc]

Now, I found that this alone was not enough to get a decent visual layout on my grid. The problem I had was that when I added in my extra columns the grid just scrunched up and fitted into the width I had set on the grid. If this happens to you then you’ll need to set the minWidth property on each column to stop them collapsing. Width alone will not help it needs to be minWidth.

,