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

Native Grid AutoFitColumn

1 Answer 203 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 12 Apr 2019, 01:57 PM

I can't seem to find anything in the docs about how to make the columns auto-fit the width of the container. In the grid wrapper, I've found https://docs.telerik.com/kendo-ui/knowledge-base/grid-autofit-all-columns-width and can use the dataBound event to access the autoFitColumn method. However, I just can't find anything similar in the docs for the native grid.

Thanks for any help I can get!!

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 16 Apr 2019, 12:52 PM
Hi Ken,

Yes indeed there is not such built in functionality in Kendo Native Vue Grid so far. 

Basically in order to achieve such behavior we have to loop through all the rendered items and calculate the width of the column depending on the length of the text in the "longest" cell. I have created a sample stackblitz example where I have implemented such behavior with a dummy data and length formula for the width. Please review it and let me know if it is something close to what you are expecting or if your scenario is somehow different.

Regards,
Plamen
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Ken
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or