undefined column width

1 Answer 112 Views
Grid
Michael
Top achievements
Rank 1
Michael asked on 12 Jan 2022, 03:01 PM
We currently save column widths to restore as users navigate between pages.  This is stored as a `number | undefined` (based on the `ColumnResizeArgs`) but in our html binding `kendo-grid-column [width]` can only accept a number.  What should we pass in to indicated `undefined`? 

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Bechev
Telerik team
answered on 17 Jan 2022, 10:11 AM

Hello Michael,

As you already explored the width property of the <kendo-grid-column> component accepts a valid number as a value.

Passing a value of typenumber | undefined will throw the following error during compilation when the strict property of the compilerOptions is set to true. 

I am assuming that this type of issue is referenced. Please correct me if my assumptions are wrong.

A possible option is to disable the strict type checking in the template as follows:

https://github.com/angular/angular/issues/37619#issuecomment-645552361

 <kendo-grid-column
          ...
          [width]="colWidth!"
        ></kendo-grid-column>

The community is waiting for a possible fix in a future version of Angular: https://github.com/angular/angular/issues/37619

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Martin Bechev
Telerik team
Share this question
or