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

Set titles by grid width

1 Answer 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 2
Iron
Veteran
Iron
Peter asked on 11 Nov 2020, 09:51 AM

Hi,

how can I check the actual grid width to set abbreviated titles on small devices?

Regards,

Peter

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 13 Nov 2020, 10:16 AM

Hello Peter,

Once the user changes the state of the grid (say, resizes a column), the StateChanged event fires where all grid columns have widths.

Before that, the standard HTML table rules apply, and they are described in detail in the Column Widths article. What is probably most relevant to your case is that if you have set widths to the columns, they will be respected. It is up to you to determine the actual px width if you use different units (such as em or rem). If you do not set widths to the columns it will be up to the browser to determine them and the grid does not know them either until a change occurs so it has to  actually calculate them (see the first paragraph).

With all that said, I think that you can use JS Interop to determine the viewport size and apply your desired business logic to the grid titles.

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Peter
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
Marin Bratanov
Telerik team
Share this question
or