ajout un bouton pour exporter l'integralité du tableau en csv

This commit is contained in:
Christophe 2022-06-30 14:14:22 +02:00
parent 88a586c163
commit b93d31c447
2 changed files with 11 additions and 4 deletions

View file

@ -694,12 +694,12 @@ let monTableau = {
}
}
},
exportCSV() {
exportCSV(quoi = 'tableau') {
let $csv = [];
let $header = [];
let $tableau = [];
Object.keys(this.header).forEach((k) => $header.push(k));
$tableau = this.tableau.reduce((acc, ligne) => {
$tableau = this[quoi].reduce((acc, ligne) => {
let $uneLigne = [];
Object.values(ligne[this.champcsv]).forEach((l) => $uneLigne.push(l));
return [...acc, [...$uneLigne]];
@ -771,6 +771,12 @@ let monTableau = {
>
<i class="fa fa-file-excel-o fas fa-file-csv" aria-hidden="true"></i>
</button>
<button class="btn gamutable--exportCSV" type="button" @click.stop="exportCSV('table')"
v-show="this.namecsv"
title="Exporter le tableau complet en csv"
>
<i class="fas fas fa-file-excel" aria-hidden="true" alt="csv"></i>
</button>
<span v-show="chargement" class="rouge">
<i class="fa fa-refresh fa-spin fa-fw rouge fas fa-sync fa-spin"></i>
<span class="texteMajBDD">

File diff suppressed because one or more lines are too long