diff --git a/src/components/datatable/DataTable.d.ts b/src/components/datatable/DataTable.d.ts index 9469159b3e..0367c4d245 100644 --- a/src/components/datatable/DataTable.d.ts +++ b/src/components/datatable/DataTable.d.ts @@ -171,6 +171,8 @@ interface DataTableUnselectParams extends DataTableSelectParams { } interface DataTableExportFunctionParams { data: any; field: string; + rowData: any; + column: Column } interface DataTableColReorderParams { diff --git a/src/components/datatable/DataTable.js b/src/components/datatable/DataTable.js index 6098c14e8f..c83d7ed5f1 100644 --- a/src/components/datatable/DataTable.js +++ b/src/components/datatable/DataTable.js @@ -1433,7 +1433,7 @@ export class DataTable extends Component { let cellData = ObjectUtils.resolveFieldData(record, field); if (cellData != null) { - cellData = this.props.exportFunction ? this.props.exportFunction({ data: cellData, field }) : String(cellData).replace(/"/g, '""'); + cellData = this.props.exportFunction ? this.props.exportFunction({ data: cellData, field, rowData: record, column }) : String(cellData).replace(/"/g, '""'); } else cellData = ''; diff --git a/src/showcase/datatable/DataTableDoc.js b/src/showcase/datatable/DataTableDoc.js index 8dec4aa951..48f47edc36 100644 --- a/src/showcase/datatable/DataTableDoc.js +++ b/src/showcase/datatable/DataTableDoc.js @@ -3328,7 +3328,9 @@ export const DataTableStateDemo = () => { null A function to implement custom export. Need to return string value.
event.data: Field data.
- event.rows: Column field. + event.field: Column field. + event.rowData: Row data. + event.column: Column. expandableRowGroups