Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
Upgraded from v6.2 to v8.3 and have column width issues
posted

Hello... I've been using the ultragrid v6.2 in an application for a while with no problems... I recently needed to use the UltraFormattedTextEditor from v8.3, so I went ahead and swapped everything over to v8.3.  programmatically everything is fine but I immediately noticed the first column in one of my grids is way too wide and it can't be resized to be any smaller.  This grid is bound to a BindingList(of Customer), as are all the grids in my app (bound to a BindingList).  The only thing different about this grid is that some of the customers have a subcollection of additional customers.   The code I'm using to bind is as follows:

Me.cboCustomers.Items.Add("")
For Each cust As Customer In _customers.Values
         custClone = DirectCast(cust.Clone, Customer)
        _customerGridCollection.Add(custClone)
        Me.cboCustomers.Items.Add(custClone)
Next
ugCustomers.DataSource = _customerGridCollection

I've got code to go through and do a PerformAutoResize on the main band and immediately after that, the column width in question shows 110 in the debugger, but still shows up at LEAST 600px wide in the grid.  It does this regardless of if I run the performautoresize code. 

If I make the subcollection of customers not browsable in the grid it looks good, but I need the subcollections visible.  When looking at the bands collection it now has 391 bands instead of three that were in the list  before the 8.3 upgrade. 

Any ideas on what I can do to get around this?   

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    DamnRock said:
    Any ideas on what I can do to get around this?   

    Yes, I have a pretty good idea why this is happening and how to fix it. The only puzzling thing here is why this didn't happen in the old version. :)

    By default, the grid column widths are synchronized across every band. Since each band is indented a little, the first column in the root-level band has to be big enough to accomodate the right-most edge of the first column in the lowest-level band.

    In this case, you are binding the grid to a data source that is recursive, so there are essentially an infinite number of bands.

    There's a property on the DisplayLayout called MaxBandDepth which defaults to 100 to prevent infinite recursion. But 100 is still pretty huge. So one thing you can do is set this property to a more reasonably number. Somewhere between 5 and 8 generally works best in my experience.

    Another thing you could do is set AllowColSizing to Free. This allows each band in the grid to have column widths that are independent of the other bands.

Reply Children
No Data