Flex Datagrid Visibility Bug

Run into a nasty little bug with Flex datagrids the other, under some situations Datagrid columns with their visibility set to false will be displayed!

Here's a workaround.

[More]

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
John W's Gravatar Damn! You rock, this has been plaguing me for some time. I had no idea it was a bug!

Thanks a ton!
# Posted By John W | 6/19/07 12:36 AM
Justin Mclean's Gravatar Took me a while to work out the workaround. BTW Just call the above function when the ArrayCollection that the DataGrid is bound to changes.
# Posted By Justin Mclean | 6/19/07 8:34 AM
Ahmad Hamid's Gravatar I found that the commitProperties of the DataGrid.as replaces visibleColumns
with columns array. I figure overriding this method and reseting
visibleColumns will solve the problem.
eg.

override protected function commitProperties():void
{
var visibleColumnstemp:Array = super.mx_internal::visibleColumns ; //workarround t
super.commitProperties();
super.mx_internal::visibleColumns = visibleColumnstemp;
}
# Posted By Ahmad Hamid | 10/26/07 7:53 AM
Dave's Gravatar Thanks for handy fix. I found using it like so proved to work pretty effectively:

<mx:DataGrid id='dg' updateComplete='fixVisibility(dg)' dataChange='fixVisibility(dg)' change='fixVisibility(dg)'>
# Posted By Dave | 5/9/08 7:03 AM
Copyright © Justin Mclean 2008
BlogCFC by Raymond Camden.