Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
900
Performance issue with sorted fields in a real-time updated grid
posted

Hi,

I have a grid that is updated in real time couple of times a second.  As far as the user is concerned, it is a read-only data grid.  The user does not edit any cells, just views the updates.  The purpose of the grid is to display the latest items at the top.  This involves in having one of the fields (a time stamp) sorted.

Without the sort, the grid performs perfectly fine.  However, when the sort is applied, the grid suffers from considerable performance, to the point where it becomes almost unusable.

I'm aware that by design, the datagrid will *not* automatically maintain the sort when the datasource is updated. The way the sort is applied, is using a workaround (mentioned here in several places) of removing and applying the sorted fields as to always automatically maintain the sort on every update. 

FieldSortDescriptionCollection sortedFields = _myDataGrid.DefaultFieldLayout.SortedFields;
var sfd = sortedFields.Where(sortField => !sortField.IsGroupBy).ToList();
foreach(var sf in sfd)
{
   sortedFields.Remove(sf);
}
foreach(var sf in sfd)
{
  sortedFields.Add(sf);
}

...
Alternatively I can do this, with equally poor performance results, but then sorting under grouping doesn't work:

_myDataGrid.Records.RefreshSort(); 

I'm not concerned with the workarounds for getting the sort to work under grouping, but just purely the performance of the infragistics sort.  I've tried to even provide my own SortComparer in the field settings of the field I am sorting, and I still get the poor performance.

Is there any way I can maintain my sort in real-time without such a huge performance penalty?