mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-11 09:52:35 +00:00
Fixed #2395 - New exportFooter
property for Exportable DataTable
This commit is contained in:
parent
ef103e0e34
commit
1a43e8a6f2
5 changed files with 38 additions and 0 deletions
|
@ -239,6 +239,12 @@ const ColumnProps = [
|
||||||
default: "null",
|
default: "null",
|
||||||
description: "Custom export header of the column to be exported as CSV."
|
description: "Custom export header of the column to be exported as CSV."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "exportFooter",
|
||||||
|
type: "string",
|
||||||
|
default: "null",
|
||||||
|
description: "Custom export footer of the column to be exported as CSV."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "hidden",
|
name: "hidden",
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
|
|
4
src/components/column/Column.d.ts
vendored
4
src/components/column/Column.d.ts
vendored
|
@ -233,6 +233,10 @@ export interface ColumnProps {
|
||||||
* Custom export header of the column to be exported as CSV.
|
* Custom export header of the column to be exported as CSV.
|
||||||
*/
|
*/
|
||||||
exportHeader?: string | undefined;
|
exportHeader?: string | undefined;
|
||||||
|
/**
|
||||||
|
* Custom export footer of the column to be exported as CSV.
|
||||||
|
*/
|
||||||
|
exportFooter?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Defines the filtering algorithm to use when searching the options.
|
* Defines the filtering algorithm to use when searching the options.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -166,6 +166,10 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
|
exportFooter: {
|
||||||
|
type: String,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
filterMatchMode: {
|
filterMatchMode: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
|
|
|
@ -1072,6 +1072,24 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//footers
|
||||||
|
let footerInitiated = false;
|
||||||
|
for (let i = 0; i < this.columns.length; i++) {
|
||||||
|
let column = this.columns[i];
|
||||||
|
|
||||||
|
if (i === 0) csv += '\n';
|
||||||
|
|
||||||
|
if (this.columnProp(column, 'exportable') !== false && this.columnProp(column, 'field')) {
|
||||||
|
if (footerInitiated)
|
||||||
|
csv += this.csvSeparator;
|
||||||
|
else
|
||||||
|
footerInitiated = true;
|
||||||
|
|
||||||
|
csv += '"' + (this.columnProp(column, 'exportFooter') || this.columnProp(column, 'footer') || this.columnProp(column, 'field')) + '"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DomHandler.exportCSV(csv, this.exportFilename);
|
DomHandler.exportCSV(csv, this.exportFilename);
|
||||||
},
|
},
|
||||||
resetPage() {
|
resetPage() {
|
||||||
|
|
|
@ -381,6 +381,12 @@ export default {
|
||||||
<td>null</td>
|
<td>null</td>
|
||||||
<td>Custom export header of the column to be exported as CSV.</td>
|
<td>Custom export header of the column to be exported as CSV.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>exportFooter</td>
|
||||||
|
<td>string</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Custom export footer of the column to be exported as CSV.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>filterMatchMode</td>
|
<td>filterMatchMode</td>
|
||||||
<td>string</td>
|
<td>string</td>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue