This is a migrated thread and some comments may be shown as answers.

GridView performance issues when sorted on column with non unique values

2 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pooja
Top achievements
Rank 1
Pooja asked on 19 Feb 2015, 07:10 PM
Hi Team,

The RadGridView performs very poorly when you sort by a column with non unique values and select many rows. The UI thread gets stuck and it takes a while for it to come back, which causes issues with updates or other user operations following it. Our test was done on 50,000 rows.

To reproduce:
1. Bind RadGridView ItemsSource to a collection with 50,000 items. Set selection mode to Extended.  Make one values of one property unique and the other constant.
2. Run the sample and sort by the column with constant value.
3. Select all rows in the grid (CTRL+A)
4. Click on any row on the grid to verify that Dispatcher thread is locked. 
Note that if grid is sorted by unique value column same operation is fairly fast.

See below for the sample view, code behind and VM to reproduce this issue.
<Window x:Class="VariousDataSources.MainWindow"
        Title="MainWindow" >
    <Window.Resources>
    </Window.Resources>
        <telerik:RadGridView x:Name="RadGridView1" GroupRenderMode="Flat" AutoGenerateColumns="True"
                             RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False"
                             ItemsSource="{Binding DataSource}" SelectionMode="Extended">
        </telerik:RadGridView>
</Window>
 
 
   public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = new MyModel();
        }
    }

public class MyRow
  {
      public int SlowColumn { get; set; }
      public int FastColumn { get; set; }
  }
 
  public class MyModel : ViewModelBase
  {
      public MyModel()
      {
 
          DataSource = new ObservableCollection<MyRow>();
          for (var i = 0; i < 50000; i++)
          {
              var row = new MyRow();
              row.SlowColumn = 1;
              row.FastColumn = i;
              DataSource.Add(row);
          }
      }
 
      public ObservableCollection<MyRow> DataSource { get; set; }
  }

2 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 20 Feb 2015, 03:20 PM
Hello,

Indeed, you are right. I was able to reproduce the issue. I logged it in our Feedback portal in order to track its progress - Performance is degraded when all items are selected in a sorted column with non unique values. Once the problem is fixed the Feedback item status will be changed to Completed. As a workaround you can use RadGridView.SelectionMode="Multiple".

I updated your Telerik points accordingly.

Regards,
Yoan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Maya
Telerik team
answered on 05 Mar 2015, 04:49 PM
Hi Pooja,

We investigated the issue and it turns out that this is the expected behavior and we cannot change it since we will introduce major performance degradation in all cases, not just this corner one. 
I wrote more information about that in the feedback item.

Regards,
Maya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Pooja
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Maya
Telerik team
Share this question
or