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
close icon

Autosize columns programmaticaly

Hello,

I would like to put in "autosize" all columns in my grid programmaticaly because my datasource change each time.
Someone can explain me how can i do that ?

Thank you.

Arnaud.

Sorry for my english.


6 Replies

SA Saravanan Arunachalam Syncfusion Team April 14, 2017 09:22 AM UTC

Hi Marchesini, 
Thanks for contacting Syncfusion’s support. 
We have analyzed your requirement and we can achieved it by using allowResizeToFit and commonWidth property of Grid control. Please refer to the following online api reference link. 
Regards, 
Saravanan A. 



MA marchesini April 20, 2017 12:52 PM UTC

Thank for your reply. I will test and i go back to you.


MA marchesini April 20, 2017 01:08 PM UTC

So i don't find commonWidth in grid, i forgot to tell you that i use "Web forms" in C#/VB.net and the link you gave me tip on API Javascript.
 


PK Prasanna Kumar Viswanathan Syncfusion Team April 21, 2017 01:01 PM UTC

Hi Marchesini, 

Sorry for the inconvenience caused. 

To set the column width based on the content, we suggest you to use only the AllowResizeToFit property in Grid.  

For more information, refer the below help document.  


Regards, 
Prasanna Kumar N.S.V 



TO Tomi replied to Prasanna Kumar Viswanathan February 12, 2020 10:12 AM UTC

Hi Marchesini, 

Sorry for the inconvenience caused. 

To set the column width based on the content, we suggest you to use only the AllowResizeToFit property in Grid.  

For more information, refer the below help document.  


Regards, 
Prasanna Kumar N.S.V 


Hi,

After  AllowResizeToFit = true,  Grid is rendering very slowly. 
Grid contais about 200 rows and  about 15 colums. When I turn AllowResizeToFit=false Grid is working normal or if row count is in around 10-20 rows everything works quit nice.
After AllowResizeToFit=True, everythign avout Grid is slow, Editpanel pops up after 2-3 second, After ColumnChooser Grid renders about 10 seconds and so on.
Looks like Resizinf colums is done for every single row seperatly for 200 times, depending on row count.




GL Gowri Loganathan Syncfusion Team February 13, 2020 07:30 AM UTC

  
Hi Tomi, 
 
Thanks for using Syncfusion Forum. 
 
Query#: After  AllowResizeToFit = true,  Grid is rendering very slowly. 
 
While using AllowResizeToFit with large number of rows and columns (for ex:- 200 rows and 15 columns) 3000 cells needs to be computed to define width to columns. This process will take time when there is more number of records and columns to calculate the width.    
    
So we suggest you to use paging (AllowPaging=”true”) to reduce time delay with better performance while using AllowResizeToFit feature. 
 
Also since you are using older version source file, it takes some more time when compared with latest source file.  So you can also upgrade to latest version. 
 
Latest version: 17.4.0.46 
 
We have attached the video demo for webform sample with AllowResizeToFit() and AllowPaging with more number of rows and columns and please find it for the reduced Time Delay with latest version: 
 
 
Please revert us, if you need more assistance on this. 
 
Regards, 
Gowri V L. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon