ColumnSizer with Auto is too slow

Hi,
I have a Datagrid with dynamic count of column (sometimes have 5 columns, sometimes 12,...) and I don't know what type data are inside (sometimes DateTime, sometimes string,...), but every time are in one column same data (not mixed in one column). So I cannot set a fixed width on the columns.
So I want to use 'ColumnSizer' with 'Auto' .... but with 2000 rows is too slow. I think it is unnecessary to calculate the size of each cell in each row

1) Is any way how to calculate width only on the first row (or first 10 rows) and others will skip with calculating?

2) Is any way how to combine two property (Auto + Size to a header) => bigger width win

Alternatively:
3) The next option is How to reset size after data are completely loaded (completely shown) to Datagrid (on button click is resize very fast). But I don't know how to recognize completely load data. Is there any event on DataGrid?


1 Reply

MK Muthu Kumaran Gnanavinayagam Syncfusion Team March 8, 2020 04:53 PM UTC

Hi Tomas, 
 
Thank you for contacting Syncfusion support. 
 
We have analyzed the reported queries and you can find the query response below. 
 
  1. Query 1: Is any way how to calculate width only on the first row (or first 10 rows) and others will skip with calculating?
We would like to let you know that when the ItemsSource is set for SfDataGrid and the ColumnSizer is set as ‘Auto’ for all the columns, the SfDataGrid tries to get the longest string value in whole data[i.e., from all rows] and calculates the final size of the column. This behavior cannot be skipped at our end. However if you don’t want all the columns to be auto sized, you can specify the ColumnSizer value individually for all columns. 
 
  1. Query 2: Is any way how to combine two property (Auto + Size to a header) => bigger width win
By default, the ColumnSizer takes the highest width value among the header cells and row cells. 
 
  1. The next option is How to reset size after data are completely loaded (completely shown) to Datagrid (on button click is resize very fast). But I don't know how to recognize completely load data. Is there any event on DataGrid?
To reset the ColumnSizer at runtime, you can call the Refresh method as like we have mentioned in our documentation. 
 
 
However, you need to identify whether all the Items have been completed loaded at your end as we haven’t process the completion of data processing at our end. 
 
Regards, 
G.Muthu kumaran. 


Loader.
Up arrow icon