We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridGroupingControl scrollbar sizing bug?

I have a GridGroupingControl into which I''m binding a custom datasource (actually just a DataTable). This DataTable has a column defined called "pk". When I display the grid, I remove this column using groupGrid.TableDescriptor.VisibleColumns.Remove("pk"); However, when I then drag a header cell to make it larger, the horizontal scrollbar does not update correctly. Columns to the right of the one I''ve sized disappear from the right-hand edge of the control, but the scrollbar doesn''t update to allow you to scroll them into view. If I comment out the above ''remove'' statement, the control behaves correctly. Is this a bug, or am I doing something wrong? Thanks!

8 Replies

AD Administrator Syncfusion Team September 8, 2004 12:19 PM UTC

I may be missing the exact sequence of steps you are doing, but I tried to see this behavior in the little sample below, and could not using version 2.1.0.9. Can you see the problem in this sample? GCCremoveviscol_3658.zip


MW Mike Woolley September 13, 2004 08:44 AM UTC

Thanks once again for your extremely quick response. The example you have provided does indeed work correctly. I haven''t had a chance to alter this example to try and reproduce the problem (our grid is embedded in a UserControl that is docked ''fill'' into a form that is then displayed using your TabbedMDI stuff, so I wonder if there is some way that the correct size information is not being communicated to the grid. I''ll get back to you if I can reproduce the problem. I have one further question - I''d like to use a GroupingGrid to be able to display a grid with two columns. The first cell in a row is a static label field from a database and the second is a cell whose type depends on information from the database. In other words, what I am trying to do is emulate the Windows Forms PropertyGrid control using your grid controls. I thought that the Grouping Grid was probably the way to go as it provides the ''sectioned'' functionality (expand/collapse, etc.) we''re after. However, I''m not sure how to change the type of the cell, or even if this is possible. Any ideas?


AD Administrator Syncfusion Team September 13, 2004 10:13 AM UTC

As far as your original problem, you might put a Panel where you now have the grid, and then drop the grid into the Panel with grid.Dock = DockStyle.Fill. This may avoid the problem you are seeing. You can dynamically set properties on cells using TableControlPrepareViewStyleInfo or QueryCellStyleInfo. Here is forum thread that discusses setting style.BackColor, but you can also try conditionally setting style.CellType there. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=17832


MW Mike Woolley September 14, 2004 01:17 PM UTC

Putting the control in a panel didn''t appear to make any difference. As an alternative, is it possible to bind a custom collection to a grid (e.g. an IList, etc.) and specify the columns that are displayed explicitly (i.e. add columns in rather than remove them). This may be a better approach (if possible) as I want to display columns containg buttons, icons, etc. based on data that is calculated (but not stored in) the collection. Once again, many thanks.


AD Administrator Syncfusion Team September 14, 2004 01:32 PM UTC

After setting the DataSource, try manually populating the Columns collection. this.gridGroupingControl1.DataSource = dt; this.gridGroupingControl1.TableDescriptor.Columns.Add("Col1"); this.gridGroupingControl1.TableDescriptor.Columns.Add("bool");


MW Mike Woolley September 14, 2004 01:45 PM UTC

Thanks, A bit confused though. If I set the DataSource, won''t the grid just create a set of columns for me anyhow?


AD Administrator Syncfusion Team September 14, 2004 01:55 PM UTC

Not if you then start modifying the Columns collection. The groupinggrid postpones its initialization until things are actually needed. So, when you set DataSource, nothing is added to the Columns collection until you try to use the collection in some manner. If at that point, they are empty, they get initialized to the default whole datasource. If before they are used, you explicitly set the Columns collection, then they will not be initialized to the whole datasource (since when you go to use them, they will not be empty.) It worked for me using a DataTable. I think it should work for you using an arbitrary IList.


MW Mike Woolley September 14, 2004 02:05 PM UTC

Ah! Great. That''s going to be a much better solution for me than removing columns that I don''t need. Thanks once again!

Loader.
Up arrow icon