4

I ve recently started working with slickgrids. So getting lots and lots of doubts. How can wordwrap the column headers in slickgrids

Prashant
  • 692
  • 2
  • 11
  • 26
Diya4ever
  • 102
  • 1
  • 5
  • 13

3 Answers3

5

I solved this by editing 2 css tags:

In slick-default-theme.css:

.slick-header-columns {
    white-space: pre !important;
    height: 45px;
}

The height here is adjustable to your needs. This was good to display 3 lines.

In slick.grid.css, change the height settings on the below tag to 100%:

.slick-header-column.ui-state-default {
    ...
    height: 100%;
    ...
}

Hope this helps!

ganeshk
  • 5,583
  • 3
  • 27
  • 31
  • Strange... it didn't work for me when putting the .slick-header-columns; instead I added the white-space property to the .slick-header-column.ui-state-default, which worked. – html_programmer Nov 08 '13 at 14:26
4

fwiw, the author of slick grid answers this question here: https://github.com/mleibman/SlickGrid/issues/61

Tomato
  • 772
  • 8
  • 17
1

I created a custom css class to enable/disable the functionality :

.slickgrid-word-wrap .slick-cell {
    white-space: normal;
    overflow: auto;
}

And then on my div container :

<div id="my-grid"
     class="slickgrid-word-wrap"></div>

And you can still set the row's height on the SlickGrid configuration like this :

var options = {
            editable: false,
            enableCellNavigation: false,
            autoExpandColumns: false,
            forceFitColumns: false,
            showFooterRow: false,
            explicitInitialization: true,
            multiColumnSort: false,
            rowHeight: 50 // <--- here
        };
Guillaume
  • 844
  • 7
  • 25