Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiecoorp/8820726 to your computer and use it in GitHub Desktop.
Save kiecoorp/8820726 to your computer and use it in GitHub Desktop.
<a id="download_csv" class="button">Téléchargement de la liste</a>
<script type="text/javascript">
var csvRows = [];
var exceptCol = [0, 1, 3, 4, 6];
jQuery('table.tablesorter tbody tr').each(function(index, row) {
var text = [];
jQuery('td.active_filter', row).each(function(index, cell) {
if( jQuery.inArray(index, exceptCol) == -1 ){
text.push(cell.innerText);
}
});
csvRows.push(encodeURIComponent(text.join(';').replace(/[\n]/gi, " - ")));
});
var csvString = csvRows.join("%0A");
var a = document.getElementById('download_csv');
a.href = 'data:attachment/csv,' + csvString;
a.target = '_blank';
a.download = 'export_comptes.csv';
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment