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
1360
Performance of adding column summaries in code behind
posted

Hi all,

I am trying to see if I can improve the performance of adding default summaries to multiple int/decimal column using code behind. It is all working fine, but the performance tails off dramatically when the number of columns gets above about 50. In an extreme test, adding summaries to 300 columns (I said extreme...) it takes around 30 seconds on a very fast machine with CPU pegging fully.

I have tried binding the itemsource to an empty list of the appropriate object and then doing the summaries but it doesnt seem to help. Are there any performance improvements anyone can suggest to speed this up?

The code to add summaries is below:

private void SetupColumnSummaries()
{
    foreach (Column col in this.MyDataGrid.Columns)
    {
        if (col.DataType == typeof(Int32) || col.DataType == typeof(decimal) || col.DataType == typeof(double))
        {
            var summary = col.SummaryColumnSettings.SummaryOperands[3];
            summary.FormatString = "{0:N0}";
            summary.IsApplied = true;
        }
        else
        {
            col.IsSummable = false;
        }
    }
}

Parents Reply Children
No Data