Completed
Last Updated: 17 Oct 2016 09:51 by ADMIN
ADMIN
Hristo
Created on: 12 Oct 2016 11:43
Category: Editors
Type: Bug Report
2
FIX. RadAutoCompleteBox - clearing the AutoCompleteItems is slow if there is a selection in the editor
How to reproduce:
Check also the attached video

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void radButton1_Click(object sender, EventArgs e)
    {
        this.radAutoCompleteBox1.AutoCompleteItems.Clear();

        List<RadListDataItem> autoCompleteEntries = new List<RadListDataItem>();
        for (int i = 0; i < 10000; i++)
        {
            autoCompleteEntries.Add(new RadListDataItem("Joe Smith", "joe@fakecompany.com"));
            autoCompleteEntries.Add(new RadListDataItem("Adam Petersen", "adam@qwerty.com"));
            autoCompleteEntries.Add(new RadListDataItem("Jack Russel", "jack@russel.nocom"));
            autoCompleteEntries.Add(new RadListDataItem("Daniel Finger", "daniel.pinger@gmail.com"));
            autoCompleteEntries.Add(new RadListDataItem("Richard Vail", "rvail@richardvail.com"));
            autoCompleteEntries.Add(new RadListDataItem("Sebastian Jonnson", "s.jonnson@sjonnson.com"));
            autoCompleteEntries.Add(new RadListDataItem("Lee Cooper", "lee.cooper@coopercoorp.com"));
            autoCompleteEntries.Add(new RadListDataItem("Kelvin Clain", "kclain@clainkevin.com"));
            autoCompleteEntries.Add(new RadListDataItem("Maria Jenson", "mjenson@mariajenson.com"));
            autoCompleteEntries.Add(new RadListDataItem("Chelsea Maarten", "chelsea@maarten.com"));
        }

        this.radAutoCompleteBox1.AutoCompleteItems.AddRange(autoCompleteEntries);
    }
}

Workaround: use Begin/End update block and reset the private patternText field:
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void radButton1_Click(object sender, EventArgs e)
    {
        typeof(RadTextBoxListElement).GetField("patternText", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this.radAutoCompleteBox1.ListElement, null);

        this.radAutoCompleteBox1.AutoCompleteItems.Clear();

        List<RadListDataItem> autoCompleteEntries = new List<RadListDataItem>();
        for (int i = 0; i < 10000; i++)
        {
            autoCompleteEntries.Add(new RadListDataItem("Joe Smith", "joe@fakecompany.com"));
            autoCompleteEntries.Add(new RadListDataItem("Adam Petersen", "adam@qwerty.com"));
            autoCompleteEntries.Add(new RadListDataItem("Jack Russel", "jack@russel.nocom"));
            autoCompleteEntries.Add(new RadListDataItem("Daniel Finger", "daniel.pinger@gmail.com"));
            autoCompleteEntries.Add(new RadListDataItem("Richard Vail", "rvail@richardvail.com"));
            autoCompleteEntries.Add(new RadListDataItem("Sebastian Jonnson", "s.jonnson@sjonnson.com"));
            autoCompleteEntries.Add(new RadListDataItem("Lee Cooper", "lee.cooper@coopercoorp.com"));
            autoCompleteEntries.Add(new RadListDataItem("Kelvin Clain", "kclain@clainkevin.com"));
            autoCompleteEntries.Add(new RadListDataItem("Maria Jenson", "mjenson@mariajenson.com"));
            autoCompleteEntries.Add(new RadListDataItem("Chelsea Maarten", "chelsea@maarten.com"));
        }

        this.radAutoCompleteBox1.ListElement.DataLayer.ListSource.BeginUpdate();
        this.radAutoCompleteBox1.AutoCompleteItems.AddRange(autoCompleteEntries);
        this.radAutoCompleteBox1.ListElement.DataLayer.ListSource.EndUpdate();
    }
}
0 comments