Skip to content

NicBright/ng-table-export

 
 

Repository files navigation

Export to CSV format for table

Code licensed under New BSD License.

Installing via Bower

bower install ng-table-export

Example

This version fixes ng-table-export for Internet Explorer 9++ (maybe even 8)

Additional Features (compared to original ng-table-export)

  • Add possibility to specify encoding of the generated csv file. For example:
<a class="btn btn-primary" ng-mousedown="csv.generate($event)" ng-href="{{ csv.link() }}" download="test.csv">Export to CSV</a>
<table ng-href ... export-csv="csv" ng-export-encoding="latin1">

Alternatively (it's just a matter of taste):

<a class="btn btn-primary" ng-mousedown="csv.generate($event, 'latin1')" ng-href="{{ csv.link() }}" download="test.csv">Export to CSV</a>
<table ng-href ... export-csv="csv">

If you omit ng-export-encoding, you will get the default (UTF-8). Right now, only UTF-8 and latin1 (i.e. ISO-8859-1 is supported).

  • In case you provide a short view in a table cell (e.g. using manual truncation of a string when it is too long) but still want the original contents to be exported, then you can do so by setting the attribute data-fulltext on the <td> or <th> element. If this attribute is present, its content is exported instead of the text() contents.

About

Export data from ngTable to CSV

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 91.8%
  • CoffeeScript 8.2%