angular-ui/ng-grid — pull request #929 by nfang (2014-01-20 23:55:23+00:00)
Title: Add support for custom templates and exporting selected items

##### Add support for custom templates

Allow developer to provide custom template to structure and style the download link. Three types of placeholder can be used to instruct the plugin in places to insert proper links:

- `{{__ALL__}}`: link to CSV download of the whole data set;
- `{{__SELECTED_ITEMS__}}`: link to CSV download of selected items;
- `{{__DEFAULT__}}`: if any item is selected, it links to `SELECTED_ITEMS`, otherwise `ALL`.

##### Add support for exporting selected items

By default, this feature is off. Developer can turn it on by setting "enableSelectionExporting" to "true" and provide a custom template with placeholders for selected items, e.g.

```

Selected only

```

##### Others

- Avoid using for...in to iterate over an array as [the order of iteration might not be guaranteed](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in);
- Watch "grid.data.length" instead of doing a hash key concatenation as the link to all data would need to be generated only when items are added/removed.