Fixed width locked column on grid with grouping

1 Answer 159 Views
Grid
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
Lee asked on 09 Dec 2022, 10:33 PM
I have a kendo grid with grouping and locked columns. One of the columns contains just an icon. That icon is in that column in every row. That column is locked on larger screens but not on smaller ones, meaning when on small screens it is always in view. I need that column to always be an exact width (60px) while the rest of the columns in the table fill in the remainder of the available space. I can't figure out how to do this because using locked columns requires that every column have a width.

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 14 Dec 2022, 01:33 PM

Hello, Lee,

You could use the autoFitColumn method to fit all columns except the one you want to be 60px.

            dataBound: function(e) {
              let grid = e.sender,
                  columns = grid.columns;

              // Auto fit all columns except for the first one.
              columns.forEach((column, i) => {
                if(i !== 0) {
                  grid.autoFitColumn(column);
                }
              });
            }

After that, to make sure there is no empty space left, you could use the approach from the following KB article:

https://docs.telerik.com/kendo-ui/knowledge-base/grid-remove-trailing-space-resize 

Dojo

https://dojo.telerik.com/@gdenchev/EQOkAmiW 

Best Regards,
Georgi Denchev
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
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
Answers by
Georgi Denchev
Telerik team
Share this question
or