We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfDataGrid trouble rendering

Hello, 

We've been using the SfDataGrid for a few months now and it works great! However, recently we encountered an issue rendering the SfDataGrid. 
We use it in a WPF application in a tab-like interface. So we can switch between views. Two of those views consist of a SfDataGrid. 
When we first start the application and load some data we can switch between the tabs just fine. After a while the switching to the SfDataGrid takes an unusually large amount of time.
When it behaves normally, loading 30,000 items with 20 or so columns takes 5 seconds, which is acceptable. 300 items takes about 1 second.
But sometimes, never the first time, the loading takes MINUTES! Either with a few hundred items or thousands. 

The waiting appears to happen somewhere in the SfDataGrid. When we switch from a DataGrid, we clear the old DataGrid by creating a new SfDataGrid and set the ItemsSource of the newly active DataGrid.
After setting the ItemsSource it occasionally takes a long time. 

This is very difficult to debug as it is not consistent. But it is a serious issue nonetheless. I know I did not provide a lot of information as I don't know what is relevant to this problem. 
Unfortunately, I can not provide all the code. Because it is embedded in our production code. But I'm happy to provide more information if you need something specific. So if there is anything I can provide, please let me know. 

Best Regards, 
Pim Vrolijk


3 Replies

SP Sowndaiyan Paulpandi Syncfusion Team October 23, 2015 10:37 PM UTC

Hi Pim,

Thanks for contacting Syncfusion Support.

We have analyzed your query about performance delay with our SfDataGridWe have prepared the sample based on your scenario and details provided by you and you can download that sample from below location,

Sample Link: http://www.syncfusion.com/downloads/support/forum/120859/ze/SfDataGrid_Performance-1452224610


In above sample, we have loaded nearly 30000 records with 20 columns in our SfDataGrid. In this sample we are not able to reproduce the your reported “loading takes MINUTES for few hundred items or thousands” issue.

We need more information on your query and could you please share the below details to us. It will be helpful for us to analyze further. 


1.  Could you please confirm whether you are using any Cellstyles or applying style using styleselectors?

2.   And please confirm whether you are using Triggers to set cell value in your application?

3.   Could please share that when you getting performance issue whether while switching different tabs or else while loading SfDataGrid initially?


Normally if we use ColumnSizer as “Auto” in SfDataGrid, column width will be calculated based on cell value of particular column and header text. If the cell value length is greater than header text length, cell value length will be set to width of column or else header text length will be set. This is the behavior of our Auto ColumnSizer in SfDataGrid. Hence if you loading more number of records with ColumnSizer as ‘Auto’ in SfDataGrid, it will take some time to load due to the behavior of ColumnSizer. So we suggest you to use ColumnSizer as “Star” or “SizeToHeader” or “None” instead of “Auto” or “AutoWithLastColumnFill” or “SizeToCell”.


Please find the following UG link to know more about Columnsizer,

UG Link:  http://help.syncfusion.com/wpf/sfdatagrid/columns#column-sizing


We are also suggest to use DataVirtualization for increasing the loading performance and please find the UG link as below,

UG Link: 
http://help.syncfusion.com/wpf/sfdatagrid/data-virtualization

We are recommend
you to use the “SfDataGrid.Dispose()” method for release the memory used by SfDataGrid.

Could you please try out the above ways to improve the loading performance in your side and please update the above requested details if you still facing the issue. 

Please let us know if you have any other queries.

Regards,
Sowndaiyan




PV Pim Vrolijk October 27, 2015 09:04 AM UTC

Hello Sowndaiyan,

Thank you for the suggestions. The tip about virtualization definitely improved our performance, but we were still facing the occasional delay. 
However, after a while we stumbled on another WPF dialog, with lots of data, unrelated to Syncfusion, having similar problems. 
So we tried some things and what solved our problem was calling GC.Collect to start the Garbage Collector before switching between the views. 
The DataGrid works great now. So it appears to be unrelated to Syncfusion. 

Thanks for the help!

Regards, 
Pim


SP Sowndaiyan Paulpandi Syncfusion Team October 28, 2015 07:12 AM UTC

Hi Pim,

Thank you for the update.

Please let us know if you need further assistance.


Regards,
Sowndaiyan.


Loader.
Live Chat Icon For mobile
Up arrow icon