Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Column Visibility Change Quirk

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Column Visibility Change Quirk
Link Posted: 18-Jan-2007 09:09
Here's a strange one. If I reorder some columns, toggle their visibility, and then refresh the grid, the data moves around to the wrong columns. For instance...

I initialize the grid like so:
fgTest.BeginInit();

fgTest.Columns.Items.Add(new Column(\"Name\"));
fgTest.Columns.Items.Add(new Column(\"Age\"));
fgTest.Columns.Items.Add(new Column(\"Fav. Color\"));

fgTest.Rows.Items.Add(new Node(new object[] { \"Jimmy\", \"7\", \"Blue\" }));
fgTest.Rows.Items.Add(new Node(new object[] { \"Jessica\", \"8\", \"Red\" }));
fgTest.Rows.Items.Add(new Node(new object[] { \"Jason\", \"7\", \"Fuchsia\" }));

fgTest.EndInit();


Then I drag the \"Fav. Color\" column in front of the \"Age\" column. Next, I toggle the visibility of the column I moved and refresh the grid:
fgTest.BeginInit(); //Remove this and everything works

fgTest.Columns.Items[\"Fav. Color\"].Visible = false;
fgTest.Refresh();

fgTest.EndInit(); //Remove this and everything works


After all that, the \"Age\" column is now showing the data that should be in the \"Fav. Color\" column. Moreover, if I make the \"Fav. Color\" column visible again, it contains data that should be in the \"Age\" column.

One last tidbit is that I've noticed this problem only occurs if I use BeginInit/EndInit when changing the column's visibility. If BeginInit/EndInit aren't present, everything works as it should.
Link Posted: 18-Jan-2007 10:15
Thanks for the trick, we'll fix this problem to the nearest FlyGrid.Net update.