ajout un bouton pour exporter l'integralité du tableau en csv
This commit is contained in:
parent
88a586c163
commit
b93d31c447
2 changed files with 11 additions and 4 deletions
|
@ -694,12 +694,12 @@ let monTableau = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
exportCSV() {
|
exportCSV(quoi = 'tableau') {
|
||||||
let $csv = [];
|
let $csv = [];
|
||||||
let $header = [];
|
let $header = [];
|
||||||
let $tableau = [];
|
let $tableau = [];
|
||||||
Object.keys(this.header).forEach((k) => $header.push(k));
|
Object.keys(this.header).forEach((k) => $header.push(k));
|
||||||
$tableau = this.tableau.reduce((acc, ligne) => {
|
$tableau = this[quoi].reduce((acc, ligne) => {
|
||||||
let $uneLigne = [];
|
let $uneLigne = [];
|
||||||
Object.values(ligne[this.champcsv]).forEach((l) => $uneLigne.push(l));
|
Object.values(ligne[this.champcsv]).forEach((l) => $uneLigne.push(l));
|
||||||
return [...acc, [...$uneLigne]];
|
return [...acc, [...$uneLigne]];
|
||||||
|
@ -771,6 +771,12 @@ let monTableau = {
|
||||||
>
|
>
|
||||||
<i class="fa fa-file-excel-o fas fa-file-csv" aria-hidden="true"></i>
|
<i class="fa fa-file-excel-o fas fa-file-csv" aria-hidden="true"></i>
|
||||||
</button>
|
</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">
|
<span v-show="chargement" class="rouge">
|
||||||
<i class="fa fa-refresh fa-spin fa-fw rouge fas fa-sync fa-spin"></i>
|
<i class="fa fa-refresh fa-spin fa-fw rouge fas fa-sync fa-spin"></i>
|
||||||
<span class="texteMajBDD">
|
<span class="texteMajBDD">
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue