Auto column sizing performance problem

Posted by: pd-lectra on 8 September 2017, 1:14 pm EST

  • Posted 8 September 2017, 1:14 pm EST

    Hello,
    I would need some hints to optimize my grid column resizing.
    Initially, I used the GetPreferredColumnWidth() method to resize automatically the columns when inserting sets of rows.
    Problem: when the grid becomes huge (50-60 columns), resizing gets very long. So, I tried to solve this problem, by attaching objects (column descriptors) to the columns (with the TAG property). These objects provide for example, a GetPreferredWidth() retrieving some default column width for columns that do not need width calculations (i.e.: columns with fixed width image cells, etc...).
    For the other columns having text cells, the GetPreferredColumnWidth() is still used. I am still trying to find a way to optimize the resizing cycle ...

    I would like to know something: if you have 100 rows in the grid, and you add 50 new rows, does the GetPreferredColumnWidth() recompute the whole cells widths or does it recalculate the width of the new added cells to adapt the column width accordingly ? Could I try to handle the problem by forcing the column to resize only in one direction (stretch direction) ?

    Hoping my question is clear.
    Thank you for your help.

  • Replied 8 September 2017, 1:14 pm EST

    I forgot to precise: I am using the 2.5 grid version.
    Bye

  • Replied 8 September 2017, 1:14 pm EST

    The GetPreferredColumnWidth will try to resize all the rows in the column.  You could try calling the SuspendLayout method before making the call to GetPreferredColumnWidth and then call the ResumeLayout method.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels