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

Grid autoFitColumns() still has line wrapping

2 Answers 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 14 Jul 2020, 03:19 PM

Hello. I am attempting to have it so that the grid's columns will be as wide as the widest value rendered. In other words, do not line wrap data or hide overflow of individual cells.

Per (https://www.telerik.com/kendo-angular-ui/components/grid/api/GridComponent/#toc-autofitcolumns), this method should adjust "the width of the specified columns to fit the entire content, including headers, without wrapping". I can verify that when the data source is specified in the client like so:
https://stackblitz.com/edit/angular-7bppyc-ujhnha?file=app%2Fapp.component.ts

 

However, if you fetch the data asynchronously, it only resizes to the width of the column header text and not the contents of the cells. 

 

 

2 Answers, 1 is accepted

Sort by
0
Bob
Top achievements
Rank 1
answered on 14 Jul 2020, 03:33 PM
It appears that when I call autoFitColumns() in the subscribe() call to the async service it's working properly. 
0
Dimiter Topalov
Telerik team
answered on 16 Jul 2020, 08:45 AM

Hello Bob,

Indeed, all the data that will be rendered in the Grid needs to be available so that the internal calculations of the autoFitColumns() method are applied properly.

Regards,
Dimiter Topalov
Progress Telerik

Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Bob
Top achievements
Rank 1
Dimiter Topalov
Telerik team
Share this question
or