Completed
Last Updated: 07 Jan 2016 20:35 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 18 Dec 2015 09:47
Category: GridView
Type: Bug Report
0
FIX. RadGridView - Excel-like filtering does not work in self-referencing hierarchy
To reproduce: use the following code snippet and follow the steps from the attached gif file.

public Form1()
{
    InitializeComponent();

    List<Item> items = new List<Item>();
    for (int i = 1; i < 10; i++)
    {
        items.Add(new Item(i, 0, "Item" + i));
    }
    Random rand = new Random();
    for (int i = 10; i < 50; i++)
    {
        items.Add(new Item(i, rand.Next(1, 10), "Item" + i));
    }
    this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "Id", "ParentId");
    this.radGridView1.DataSource = items;
    this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
    this.radGridView1.EnableFiltering = true;
    this.radGridView1.ShowHeaderCellButtons = true;
}

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

    public int ParentId { get; set; }

    public string Name { get; set; }

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

Workaround: use the basic filtering
0 comments