Completed
Last Updated: 14 Mar 2016 08:19 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 25 Feb 2016 13:57
Category: GridView
Type: Bug Report
0
FIX. RadGridView - CompositeFilterDescriptor does not work when using an enumeration
To reproduce:
public Form1()
{
    InitializeComponent();

    BindingList<Item> items = new BindingList<Item>();
    for (int i = 0; i < 10; i++)
    {
        items.Add(new Item(i,"Item" + i , DeliveryType.Type1));
    }
    for (int i = 10; i < 20; i++)
    {
        items.Add(new Item(i, "Item" + i, DeliveryType.Type2));
    }
    for (int i = 20; i < 30; i++)
    {
        items.Add(new Item(i, "Item" + i, DeliveryType.Type3));
    }
    this.radGridView1.DataSource = items;
    this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; 
    
    this.radGridView1.EnableFiltering = true;
    CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("DeliveryType", FilterOperator.IsEqualTo, DeliveryType.Type2));
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("DeliveryType", FilterOperator.IsEqualTo, DeliveryType.Type3));
    compositeFilter.LogicalOperator = FilterLogicalOperator.Or;
  
    this.radGridView1.FilterDescriptors.Add(compositeFilter);
}

public class Item
{
    public int Id { get; set; }

    public string Name { get; set; }

    public DeliveryType DeliveryType { get; set; }

    public Item(int id, string name, DeliveryType deliveryType)
    {
        this.Id = id;
        this.Name = name;
        this.DeliveryType = deliveryType;
    }
}

public enum DeliveryType
{ 
    Type1,
    Type2,
    Type3
}

Workaround: use custom filtering: http://docs.telerik.com/devtools/winforms/gridview/filtering/custom-filtering
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments