Search code examples
cssslickgrid

how do I apply a class to the header cell for a column in slickgrid


I have a column in slickgrid where all the cells need to have some padding applied to the right side of the cell. I use the cssClass property when initializing the columns for the grid, but this applies only to the non-header cells of the column. How do I specify a css class to use for the header as well so I can apply the right padding to it as well? Without that padding, the header cell becomes slightly out of line with the rest of the cells below it.


Solution

  • If these styles apply to all cells, you can style them using the built-in .slick-cell and .slick-headerrow-column CSS classes. One thing to watch out for, however, is that your styles may not override SlickGrid's defaults if they have lower rule specificity. If that's an issue in your app, either increase specificity of your rules or use !important - .slick-cell { padding-right:10px !important; }.