4

I know that there is no API to remove the header row, but I'm sure it can be done by modifying some CSS. Any ideas ?

For example, here: http://mleibman.github.com/SlickGrid/examples/example4-model.html

CSS experts ! I need your help with this one. I'm interested in changing the CSS code of the package that removes the header row. CSS code that can be loaded on top of the package is preferred. The source code is here: http://github.com/mleibman/SlickGrid (Press "Download Source")

Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746

6 Answers6

6

The short answer is that doing this is not supported in SlickGrid, at least at the moment. The CSS workaround doesn't work because SlickGrid uses the DOM elements in the header to calculate the dimensions of the viewport. Setting it to display:none makes SlickGrid think that the grid is 0 pixels wide.

You can sort of get around it by doing $(".slick-header-columns").css("height","0px") followed by a call to grid.resizeCanvas() to get rid of the remaining whitespace at the bottom of the grid.

Blowsie
  • 40,239
  • 15
  • 88
  • 108
Tin
  • 9,082
  • 2
  • 34
  • 32
  • Thanks ! The workaround works :) It would be nice to have this basic(?) feature in the future. Thank you for your time ! – Misha Moroshko Apr 30 '10 at 07:12
  • @moroshko: You can always add it to Issues on GitHub as a feature request ;) – Tin Apr 30 '10 at 16:45
  • 4
    You can, at least with 2.0, set css styles and the grid will handle it without explicitly needing to do it via javascript and calling grid.resizeCanvas() as it is calculated correctly on the first render. .slick-header-columns{ height: 0px; } .slick-header.ui-state-default{ border: none; } – Chris Janssen Apr 26 '12 at 00:22
4

Just add the following to the grid options:

headerHeight: 0

and then in your css put something like:

#myGridID .slick-header-columns {
  display: none;
}
eugenevb
  • 41
  • 1
2

I had the same problem and simply not displaying does work:

$(element).find('.slick-header').css('display', 'none');
xlecoustillier
  • 16,183
  • 14
  • 60
  • 85
dec
  • 594
  • 1
  • 9
  • 18
  • 1
    This is a great answer, as it doesn't modify all the SlickGrid elements, but instead only the ones found in a container! – El Developer Apr 19 '16 at 04:01
1

Another way to do this is to add one line to the slick.grid.js

function createColumnHeaders() { return; }

if you add a return to the first line inside of createColumnHeaders it seems to remove the headers.

1

This should probably work:

.slick-header-columns { display: none; }
Deniz Dogan
  • 25,711
  • 35
  • 110
  • 162
0

Maybe late, but works for me

$('#myGrid').find('.slick-header-column.ui-state-default').css('display', 'none');