Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angularjs ng-grid: how to change header style

How can I restyle the header of ng-grid? In particular how can I change the background-color and the text color of the header row?

like image 664
klode Avatar asked Jul 02 '14 20:07

klode


2 Answers

You can override the background-color property on the .ngHeaderCell class declared in the ng-grid.css to use the background color you want on the header cells.

If you don't want to modify the original ng-grid css, you can create your own css and load it after ng-grid's css in which you can later overide the same .ngHeaderCell class with:

.ngHeaderCell {
    background-color: [your background color] !important;
    bottom: 0;
    color: [your foreground color] !important;
    position: absolute;
    top: 0;
}
like image 61
Roberto Linares Avatar answered Sep 27 '22 20:09

Roberto Linares


I haven't looked into ng-grid before, but looks like a css file is provided for styling? I would advise either changing the actual css file, or over-writing these changes by declaring your own below where the grid.css is declared. Check link if that is what you are talking about.

https://github.com/angular-ui/ng-grid/blob/master/ng-grid.css

For instance, one of the css attributes in the above file is below, just do a ctrl-f and find the attributes you are looking to change.

.ngHeaderCell {
    position: absolute;
    top: 0;
    bottom: 0;
    background-color: inherit;
 }
like image 22
Jeremy Avatar answered Sep 27 '22 20:09

Jeremy