Is it possible to set the width of the grid columns programmatically?

1 Answer 412 Views
Grid
Flavio
Top achievements
Rank 1
Flavio asked on 27 Apr 2023, 09:38 PM

I would like to retrieve the width of the gris columns (to save it) and programmatically set it when needed.

I tried using gridref.GridColumns but I don't know how to retrieve gridcolumn object.

 

Flavio
Top achievements
Rank 1
commented on 27 Apr 2023, 09:56 PM | edited

Edit
I used this way to set width programmatically but I dont know how to retrieve current columns width to save it:

the method "GetColumnWidth" retrieve column width by column name and set it.

 <GridColumns>
        <GridCheckboxColumn />
        <GridColumn Field=@nameof(Order.Id) Width="@GetColumnWidth("Id")" Title="ID" Editable="false" Filterable="false" />
      

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 02 May 2023, 04:41 AM

Hi Flavio,

The correct way to retrieve Grid column information is via the Grid state. See this example in the article.

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Tags
Grid
Asked by
Flavio
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or