angular-ui/ng-grid — pull request #2218 by russell-miller (2014-11-24 23:43:26+00:00)
Title: New option: sectionHeaders - display column headers within section labels

At Rentrak we had a need for an Angular grid that could display column headers in sections.

Our fork of ui-grid does so by swapping out the headerTemplate with a slightly different one that iterates over a new option `sectionHeaders` to eventually find values within `columns` array(s) - those being the names of real grid columns that it renders as it normally would.

Example:

```javascript
$scope.gridOptions = {
data: [],
columnDefs: [
{ name: 'col1' },
{ name: 'col2' }
],
sectionHeaders: [
{ displayName: 'Section', columns: [ 'col1', 'col2' ] }
]
};
```

Another need we had was to be able to take this as deep as we want per grid. So this is defined recursively in the new template. This means you can put sections within sections using the attribute `subSections`.

Example:

```javascript
$scope.gridOptions = {
data: [],
columnDefs: [
{ name: 'col1' },
{ name: 'col2' },
{ name: 'col3' }
],
sectionHeaders: [
{ displayName: 'Super Section', subSections: [
{ displayName: 'Section A', columns: [ 'col1', 'col2' ] },
{ displayName: 'Section B', columns: [ 'col3' ] }
]
]
};
```

Screenshot:
![section-headers](https://cloud.githubusercontent.com/assets/9891695/5175428/90c73920-73ef-11e4-89f9-c6a4ae944a2e.png)

*Possible Concerns*:
* maybe this should have been a separate module instead of part of core? not sure how much more work would be entailed
* there was a seemingly minor feature loss for any grids with section headers - the following style is not applied to the first column header in the template `ng-style="$index === 0 && colContainer.columnStyle($index)"`
* no tests for the recursively defined directive - would be open to suggestions for how to add testing