Completed
Last Updated: 03 Apr 2020 11:44 by ADMIN
Release R1 2019 SP1
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 25 Nov 2015 09:07
Category: MultiColumnCombo
Type: Bug Report
5
FIX. RadMultiColumnComboBox - filtering performance and cursor lagging
To reproduce:

Repository commonRepository = new Repository();

public Form1()
{
    InitializeComponent();

    InitializeDropDown();

    this.radMultiColumnComboBox1.DropDownMinSize = new Size(1100, 400);
    this.radMultiColumnComboBox1.EditorControl.ViewCellFormatting += EditorControl_ViewCellFormatting;
}

private void EditorControl_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.Row is GridViewDataRowInfo && e.CellElement is GridRowHeaderCellElement)
    {
        e.CellElement.Text = e.RowIndex.ToString();
    }
}

public class Instrument
{ 
    public string Isin { get; set; }

    public string Description { get; set; }
    
    public string AlphaCode { get; set; }
    
    public string MicMarketplaceCode { get; set; }
    
    public string WorpMarketPlaceDescription { get; set; }
     
    public string InstrumentType { get; set; }
   
    public string DerivateIsin { get; set; }
    
    public int Order { get; set; }
}

public class Repository
{
    public BindingList<Instrument> GetInstruments()
    {
        Random rand = new Random();
        BindingList<Instrument> list = new BindingList<Instrument>();
        for (int i = 0; i < 80000; i++)
        {
            list.Add(new Instrument()
            {
                Isin = Guid.NewGuid().ToString(),
                Description = "Description" + i,
                AlphaCode = "Code" + i,
                MicMarketplaceCode = "MicCode" + i,
                WorpMarketPlaceDescription = "MPdescription" + i,
                InstrumentType = "Type" + i % 3,
                DerivateIsin = Guid.NewGuid().ToString(),
                Order = rand.Next(1, 100)
            });
        }
        return list;
    }
}

public void InitializeDropDown()
{
    var ui = TaskScheduler.FromCurrentSynchronizationContext();

    Task.Factory.StartNew(() =>
    {
        var result = commonRepository.GetInstruments();
        return result;
    }).ContinueWith(res =>
    {
        if (res.IsCompleted)
        {
            this.radMultiColumnComboBox1.DisplayMember = "Description";
            this.radMultiColumnComboBox1.ValueMember = "Isin";
            this.radMultiColumnComboBox1.AutoFilter = true;

            this.radMultiColumnComboBox1.DataSource = res.Result;

            CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();

            FilterDescriptor code = new FilterDescriptor("Isin", FilterOperator.Contains, "");
            FilterDescriptor description = new FilterDescriptor("Description", FilterOperator.Contains, "");
            FilterDescriptor alphaCode = new FilterDescriptor("AlphaCode", FilterOperator.Contains, "");
            FilterDescriptor micMarketplaceCode = new FilterDescriptor("MicMarketplaceCode", FilterOperator.Contains, "");
            FilterDescriptor worpMarketPlaceDescription = new FilterDescriptor("WorpMarketPlaceDescription", FilterOperator.Contains, "");
            FilterDescriptor instrumentType = new FilterDescriptor("InstrumentType", FilterOperator.Contains, "");
            FilterDescriptor derivateIsin = new FilterDescriptor("DerivateIsin", FilterOperator.Contains, "");

            compositeFilter.FilterDescriptors.Add(code);
            compositeFilter.FilterDescriptors.Add(description);
            compositeFilter.FilterDescriptors.Add(alphaCode);
            compositeFilter.FilterDescriptors.Add(micMarketplaceCode);
            compositeFilter.FilterDescriptors.Add(worpMarketPlaceDescription);
            compositeFilter.FilterDescriptors.Add(instrumentType);
            compositeFilter.FilterDescriptors.Add(derivateIsin);

            compositeFilter.LogicalOperator = FilterLogicalOperator.Or;

            this.radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(compositeFilter);

            this.radMultiColumnComboBox1.EditorControl.BestFitColumns();

            for (int i = 0; i < this.radMultiColumnComboBox1.EditorControl.Columns.Count; i++)
            {
                var column = this.radMultiColumnComboBox1.EditorControl.Columns[i];

                switch (column.Name)
                {
                    case "Isin":
                        column.HeaderText = "Header Isin";
                        column.Width = 120;
                        break;
                    case "Description":
                        column.HeaderText = "Header Description";
                        break;
                    case "AlphaCode":
                        column.HeaderText = "Header AlphaCode";
                        break;
                    case "MicMarketplaceCode":
                        column.HeaderText = "Header MicMarketplaceCode";
                        break;
                    case "WorpMarketPlaceDescription":
                        column.HeaderText = "Header WorpMarketPlaceDescription";
                        break;
                    case "InstrumentType":
                        column.HeaderText = "Header InstrumentType";
                        break;
                    case "DerivateIsin":
                        column.HeaderText = "Header DerivateIsin";
                        break;
                    case "Order":
                        column.IsVisible = false;
                        break;
                }
            }

            this.radMultiColumnComboBox1.SelectedItem = null;

            this.radMultiColumnComboBox1.Text = "Instrument";
            this.radMultiColumnComboBox1.ForeColor = Color.Gray;

            this.radMultiColumnComboBox1.MultiColumnComboBoxElement.DropDownWidth = 550;
        }
        else
        {
            RadMessageBox.Show(res.Exception.Message);
        }
    }, ui);
}

Workaround: use custom filtering instead of CompositeFilterDescriptor:

FilterDescriptor filter = new FilterDescriptor();
filter.PropertyName = this.radMultiColumnComboBox1.DisplayMember;
filter.Operator = FilterOperator.Contains;
this.radMultiColumnComboBox1.EditorControl.MasterTemplate.FilterDescriptors.Add(filter);
this.radMultiColumnComboBox1.EditorControl.EnableCustomFiltering = true;
this.radMultiColumnComboBox1.EditorControl.CustomFiltering += EditorControl_CustomFiltering;

 private void EditorControl_CustomFiltering(object sender, GridViewCustomFilteringEventArgs e)
 {
     string searchText = this.radMultiColumnComboBox1.MultiColumnComboBoxElement.EditorElement.Text;
     if (searchText != string.Empty)
     {
         Instrument instrument = e.Row.DataBoundItem as Instrument;

         e.Handled = true;
         e.Visible = instrument.Isin.Contains(searchText) || instrument.Description.Contains(searchText) || instrument.AlphaCode.Contains(searchText) ||
                     instrument.MicMarketplaceCode.Contains(searchText) || instrument.WorpMarketPlaceDescription.Contains(searchText) ||
                     instrument.InstrumentType.Contains(searchText) || instrument.DerivateIsin.Contains(searchText);
     }
 }
3 comments
ADMIN
Stefan
Posted on: 15 Aug 2017 11:57
Hi Subramanya,

the property was introduced with the R2 2017 release and is part of RadMultiColumnComboBox. Please give it a try and if you have any concerns, feel free to reach out to our support folks at https://www.telerik.com/account/support-tickets. 
Subramanya
Posted on: 06 Jul 2017 07:20
We have Licensed version of Telerik dev craft(2015.3.930).

Presently I am trying your New version R2 2017 . after the succesfull installation of 2017 and as per your comment I am not getting the AutoFilterDelay  for the Multicolumn combo and also in tlerik grid view with multicolumn combobox column. kindly help me out, so that I can decide for the licence renewal. 
ADMIN
Ralitsa
Posted on: 25 Apr 2017 12:00
Since R2 2017 version, you can improve the user experience when cursor lagged. Here is the code snippet how to achieve it: 
this.radMultiColumnComboBox1.AutoFilterDelay = 1000;