Fixed #2395 - New `exportFooter` property for Exportable DataTable
parent
ef103e0e34
commit
1a43e8a6f2
|
@ -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",
|
||||||
|
|
|
@ -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…
Reference in New Issue