I create a GridModel independent of a GridControl, set it up and attach it to a control. I insert columns into the GridModel and some of them are hidden, using InsertRange with GridModelInsertRangeOptions.RowColHide. When I attach the GridModel to the GridControl, the appropriate columns are hidden, but the horizontal scroll bar still includes all of the hidden columns, so you scroll right for a long time before anything visibly happens in the grid.
AD
Administrator
Syncfusion Team
March 29, 2005 08:32 PM UTC
This is a defect. I have logged it in our open issues database as issue 147.
There is a private method, UpdateInsertCols, in GridControlbase that might work around the problem. But since it is private, you would ave to call that method using reflection. You could call it after you attach the model with UpdateInsertCols(1, Model.ColCount).
TA
Tom Abraham
March 29, 2005 09:43 PM UTC
I''m surprised, but even calling that method via reflection does not update the scrollbar.
AD
Administrator
Syncfusion Team
March 30, 2005 01:56 AM UTC
Tom,
could you upload a small sample project that demonstrates the problem? That helps us make sure we use exactly the same setup that you have and we should be able to provide a workaround then.
Thanks,
Stefan
>I''m surprised, but even calling that method via reflection does not update the scrollbar.
TA
Tom Abraham
April 4, 2005 06:00 PM UTC
New app, put a grid on it called _grid1.
Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim model As New GridModel
model.Rows.DefaultSize = 17
model.Cols.DefaultSize = 65
model.RowHeights.Item(0) = 21
model.ColWidths.Item(0) = 35
Dim options As New GridModelInsertRangeOptions
options.RowColHide = New Boolean() {False, True, True, True, True, False, False, False, False, False}
model.Cols.InsertRange(0, 10, options)
model.Rows.InsertRange(0, 10)
model.ActiveGridView = _grid1
_grid1.Attach(model)
End Sub
Resize the window as necessary and you''ll see that the grid does not change until the scroll bar is way to the right.
In Excel 2003, the scrollbar always sizes for all columns, even hidden, but when you click right it jumps over to the position of the first visible column and continues from there.
TA
Tom Abraham
April 8, 2005 06:17 PM UTC
Any updates?
AD
Administrator
Syncfusion Team
April 11, 2005 07:27 PM UTC
Hi Tom,
I uploaded a sample project
VB_HiddenColumns.zip. It shows how to workaround the issue using a helper method that manually fixes the columns using reflection.
Call the helper method FixHiddenRowsAndColumnsAfterModelAttach after your call to Attach(gridModel). See Form1.vb
Stefan
TA
Tom Abraham
April 11, 2005 08:54 PM UTC
Thanks. That''s quite a workaround. It seems to have the side effect of leaving the horizontal scroll position in, in my case, the middle of the visible columns instead of at the leftmost visible column as before. Any ideas on that? I can do ScrollCellInView() if I have to.
Tom
AD
Administrator
Syncfusion Team
April 11, 2005 10:19 PM UTC
Hi Tom,
that didn''t happen in my sample.
But here is some code you can use to manually set the LeftColIndex to the first non-hidden column. Maybe that helps
Dim leftMostColumn As Int32 = 100
Dim colIndex As Int32
For colIndex = 1 To _grid1.Model.ColCount
If Not _grid1.Model.HideCols(colIndex) Then
leftMostColumn = colIndex
Exit For
End If
Next
_grid1.LeftColIndex = leftMostColumn
Stefan
>Thanks. That''s quite a workaround. It seems to have the side effect of leaving the horizontal scroll position in, in my case, the middle of the visible columns instead of at the leftmost visible column as before. Any ideas on that? I can do ScrollCellInView() if I have to.
>
>Tom