Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendo Angular2 Grid - Auto resize grid columns based on page width

I am trying to figure out how to make Kendo Angular Grid resize the columns automatically based on the page width. Take this three column grid as an example:

  1. Column with static width of 50px
  2. Column with 40% width
  3. Column with 60% width

When the grid resizes horizontally, I want the 2nd and 3rd columns to resize and fill in the rest of the space based on the percent width.

like image 236
ImthiyazPH Avatar asked Jul 03 '26 20:07

ImthiyazPH


1 Answers

Got the answer from the Progress team. Posting the solution here as it will be useful for others:

<kendo-grid [data]="gridData" [height]="410" >
    <kendo-grid-column field="ProductName" title="Name" width="300">
    </kendo-grid-column>
    <kendo-grid-column field="Category.CategoryName" title="Category" [headerStyle]="{'width': '80%'}" [style]="{'width': '80%'}">
    </kendo-grid-column>
    <kendo-grid-column field="UnitPrice" title="Price" [headerStyle]="{'width': '20%'}" [style]="{'width': '20%'}">
    </kendo-grid-column>
</kendo-grid>
like image 66
ImthiyazPH Avatar answered Jul 06 '26 10:07

ImthiyazPH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!