Repro-steps
Expected behavior
Observed behavior
The problem is, after each (!!!) deleted row (not after all deleted rows) the sort-routine kicks in. Sorting all remaining rows. That is 7999 times to many.
One can argue that sorting after deleting something is not required at alle, since the order of the remaining rows (in this case none, but in one cases maybe more) will never change.
I also noticed a HybridIndex is used, possibly to increase performance during adding. Somehow it might hinder performance during deleting stuff.
Hello, Martin,
I was able to observe the slow rows removing when grid is sorted by a column. These are the performed steps:
1. Sort one of the columns
2. Press Ctrl+A to select all rows
3. Press Delete
private void FillGrid()
{
this.radGridView1.Rows.Clear();
this.radGridView1.Columns.Clear();
this.radGridView1.Columns.Add("Id");
this.radGridView1.Columns.Add("Name");
this.radGridView1.BeginUpdate();
for (int i = 0; i < 8000; i++)
{
this.radGridView1.Rows.Add(i, "Item" + i);
}
this.radGridView1.EndUpdate();
this.radGridView1.MultiSelect = true;
}
The attached gif file illustrates the difference in the required time for deleting the rows when there is a sorted column.
I have approved this bug report. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.
I have also updated your Telerik points.
Currently, the possible solution that I can suggest is to handle the Delete key and remove the applied sorting before deleting the rows:
BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior;
gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomGridDataRowBehavior());
public class CustomGridDataRowBehavior : GridDataRowBehavior
{
protected override bool ProcessDeleteKey(KeyEventArgs keys)
{
this.GridControl.SortDescriptors.Clear();
return base.ProcessDeleteKey(keys);
}
}
I hope this helps.
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.