BigDevJames
BigDevJames

Reputation: 2664

Can I make my kendo-grid-column width size based on the header content?

I have an Angular 6 application that I am building and I am using kendo-grid for some table data. Everything works great except that the column headers are "too long" and are cut to ellipsis on my desktop. Is there a way to wrap the text of the header or to make the column width be based on the column header text. I can make the width fixed, but I would like to avoid doing that.

Upvotes: 0

Views: 2758

Answers (1)

topalkata
topalkata

Reputation: 2098

You can either overwrite the default styling via CSS to wrap the content, e.g.:

encapsulation: ViewEncapsulation.None,
styles: [`
  .k-grid .k-header {
    white-space: normal;

  }
`]

EXAMPLE

... or use the autoFitColumns() method after the Grid is rendered:

EXAMPLE

Upvotes: 1

Related Questions