Completed
Last Updated: 13 Dec 2017 14:38 by ADMIN
ADMIN
Hristo
Created on: 08 Dec 2017 13:29
Category: GridView
Type: Bug Report
1
FIX. RadGridView - improve the performance when opening the RadListFilterPopup for columns having many distinct items
Currently the time for opening the popup for a column with 100 000 unique items including blank items is about 8s, this can be optimized.

How to reproduce: 
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        this.radGridView1.EnableFiltering = true;
        this.radGridView1.ShowHeaderCellButtons = true;

        this.radGridView1.DataSource = this.GetData();
        this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

        this.radGridView1.MouseDown += RadGridView1_MouseDown;
        this.radGridView1.FilterPopupInitialized += RadGridView1_FilterPopupInitialized;
    }

    Stopwatch sw = new Stopwatch();

    private void RadGridView1_MouseDown(object sender, MouseEventArgs e)
    {
        GridFilterButtonElement btn = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridFilterButtonElement;
        if (btn != null)
        {
            sw.Start();
        }
    }

    private void RadGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e)
    {
        ((RadListFilterPopup)e.FilterPopup).PopupOpened += Form1_PopupOpened;
        
    }

    private void Form1_PopupOpened(object sender, EventArgs args)
    {
        sw.Stop();
        Console.WriteLine("Total: " + sw.ElapsedMilliseconds);
    }

    private DataTable GetData()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("Id", typeof(int));
        dt.Columns.Add("Name", typeof(string));
        dt.Columns.Add("Date", typeof(DateTime));
        dt.Columns.Add("Bool", typeof(bool));
        for (int i = 0; i < 100000; i++)
        {
            dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0);
        }


        dt.Rows.Add(1, null, DateTime.Now.AddDays(1), false);
        return dt;
    }
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments