|
| 1 | +## Multiple Column Header Rows |
| 2 | + |
| 3 | +### Description |
| 4 | + |
| 5 | +Angular-Slickgrid by default will use 2 rows to display each Column Headers, in some cases you might want to change that. |
| 6 | + |
| 7 | +### Using SASS variable |
| 8 | + |
| 9 | +If you use SASS, you can simply change the $slick-header-row-count variable and you're good to go. However, please note that this affects all your grids. If that is not what you want then keep reading. |
| 10 | + |
| 11 | +Example: |
| 12 | + |
| 13 | +```scss |
| 14 | +$slick-header-row-count: 2; |
| 15 | +@import '../node_modules/angular-slickgrid/styles/sass/slickgrid-theme-bootstrap.scss'; |
| 16 | +``` |
| 17 | + |
| 18 | +### Change x rows for only 1 grid |
| 19 | + |
| 20 | +In the case that you want to change the number of rows used to display each Column Headers, you will have to use a little bit more SASS code and the gridId of your grid. |
| 21 | + |
| 22 | +For example, let say your grid as the gridId of mygrid, with the following code |
| 23 | + |
| 24 | +```html |
| 25 | +<angular-slickgrid |
| 26 | + gridId="mygrid" |
| 27 | + [columnDefinitions]="columnDefinitions" |
| 28 | + [gridOptions]="gridOptions" |
| 29 | + [dataset]="dataset"> |
| 30 | +</angular-slickgrid> |
| 31 | +``` |
| 32 | + |
| 33 | +You have to copy the id mygrid into the SASS code shown below (replace mygrid to your need). You also need to adjust the height in pixels, for 3 rows 55px seems to be a good number to use. You can also move the sort indicators as shown below. |
| 34 | + |
| 35 | +```scss |
| 36 | +#slickGridContainer-mygrid { |
| 37 | + .slickgrid-container .slick-header-columns { |
| 38 | + .slick-header-column { |
| 39 | + height: 55px; |
| 40 | + |
| 41 | + .slick-sort-indicator, .slick-sort-indicator-numbered { |
| 42 | + top: 40px; |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +Also note that if you use a stylesheet attached to your component (or inline), you might need to change the encapsulation to use the ViewEncapsulation.None, like this: |
| 50 | + |
| 51 | +```ts |
| 52 | +@Component({ |
| 53 | + selector: 'demo', |
| 54 | + encapsulation: ViewEncapsulation.None, |
| 55 | + styleUrls: ['./demo.component.scss'], |
| 56 | + templateUrl: './demo.component.html' |
| 57 | +}) |
| 58 | +``` |
0 commit comments