Completed
Last Updated: 27 Oct 2021 08:48 by ADMIN
Release 2.28.0
Christian
Created on: 30 Mar 2021 17:37
Category: Grid
Type: Feature Request
33
Programmatically invoke Fit to Width functionality for the grid columns
I want to be able to invoke the fit feature of the grid programmatically, so that the user does not have to double click the column border. Ideally, this should be possible per column, or for all columns.
3 comments
ADMIN
Marin Bratanov
Posted on: 22 Apr 2021 18:11

Hello Gerhard,

You can Follow the size limit for grid columns here: https://feedback.telerik.com/blazor/1459066-grid-column-min-width. It is a separate feature from invoking the automatic size calculation and at this point I can't say which will arrive first.

Whether and how columns can stretch or produce scrollbars on the grid depends heavily on the number of columns, their Width settings and the current width of the grid, and you can read more about it in the following article - it would not really depend on the autofit feature, that feature will merely set the Width of the column, the rest of the behavior is CSS and browser-based: https://docs.telerik.com/blazor-ui/components/grid/columns/width.

Regards,
Marin Bratanov
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Gerhard
Posted on: 22 Apr 2021 10:33

As part of this, it would be nice if I could specify min/max widths on columns as well as designate which column(s) to size beyond the content size to fill remaining space. So if the content results in a column that is not wide enough to fill remaining space in the grid/view, it stretches to fill the space and ignores the "fit to content size". 

Calling this programmatically is fine since I should know when it is save to let the rendering happen (https://feedback.telerik.com/blazor/1513385-autofit-column-widths-on-data-load#).

Christian
Posted on: 01 Apr 2021 14:49

If possible, I would also like to control somehow when the Grid is rerendered after setting the column width - example:

I have a Grid with 10 columns and want to set "fit to width" at 5 columns (or all) -> then I would have to call the "fitting method" for every column -> This would probably lead to a StateHasChanged() call per column which may lead to a performance hit (see concerns from https://feedback.telerik.com/blazor/1513385-autofit-column-widths-on-data-load

-> So it would be good to be able to "trigger" the Grid UI update programmatically after all columns are "fitted"