Completed
Last Updated: 30 Mar 2021 17:40 by ADMIN
Release 2.23.0
Karl
Created on: 26 Nov 2019 20:10
Category: Grid
Type: Feature Request
59
Fit grid column widths to content

Hello,

I am currently fiddling around with the Blazor UI, mainly the grid. I was wondering if it is possible to configure the grid to automatically fit the columns to the contents they have?

 

Meaning that the width of the header and the content cells of a given column are automatically set to a value which best fits either the cells content or the header title (depending on what takes up more space).

 

Best Regards,

 

Karl

4 comments
ADMIN
Marin Bratanov
Posted on: 30 Mar 2021 17:40

Hello Christoph and anyone else interested in extending this feature,

You can Follow the implementation of new enhancements to the column autofit here:

If you are interested in this type of functionality, make sure to click the Vote button so we can gauge that interest.

 

Regards,
Marin Bratanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Christian
Posted on: 30 Mar 2021 14:57

Hi,

I was also following this item because we also need this in our application. But I'm wondering if I got the feature request wrong or if Telerik just didn't implement it the way it should have been according to the request.

With this new feature, the user has to double-click the column to set the width, but I (and I think also Karl) was looking for kind of an "autofit" parameter (or Width="auto" value, etc) which forces the Grid to perform this resizing after data is loaded -> also see the request, which was marked as "duplicated" for this request:

https://feedback.telerik.com/blazor/1451069-autofit-for-one-or-all-blazor-grid-column-s

Or am I just missing some documentation and this was released with 2.23.0?

 

Thanks and Best Regards,

Christoph

cmarsh
Posted on: 12 Jun 2020 16:34
I would like to add that I would like to set the width to the Header or the width of the Data in the cells. 
Sometimes the cells are too wide but their headers seem to be a must.
ADMIN
Marin Bratanov
Posted on: 27 Nov 2019 09:56

Hello Karl,

The default grid behavior in terms of column widths is explained here: https://docs.telerik.com/blazor-ui/components/grid/columns/width and it stems from the table-layout: fixed CSS rule the grid has by default. Even if you override it to "auto", the cells in the content may fit their texts, but the headers will go out of alignment, because, under the covers, they are in a separate table, so both of them can't affect each other directly or with CSS alone. Such functionality will require a JavaScript implementation on our end.

I have also moved this thread to the Feedback Portal so you can Follow its status. Here's a link for you: https://feedback.telerik.com/blazor/1443922-fit-grid-column-widths-to-content.

 

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor