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

Get and Set the Column width

2 Answers 567 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 03 Feb 2021, 09:54 AM

Hi,

I can set the Grid property Resizable="true" to allow the user to adjust the column width.

I want save all column width in the Localstorage to restore it after a page refresh.

How can I read the width of all columns and set at first load? I use Blazor Server.

Exists an event "OnColumnWidthResized"?

Best regards,

Peter


2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 03 Feb 2021, 01:53 PM

Hello Peter,

You can do this through the grid state - both saving the column size, order, as well as filter, sorting, grouping, paging, and so on. You can find an example in the Persist State online demo - it's nearly codeless (two event handlers, a few lines of code, a serialize and deserialize call in the service).

As for an event - the StateChanged event fires when the columns change, you can read more about this in the documentation about the grid state - I recommend you skim through all the intro too, as this feature opens up a lot of possibilities.

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/.

0
Peter
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 03 Feb 2021, 02:45 PM

Hello Marin,

Perfect. Thank you for the complete example.

Best Regards,

Peter

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