diff --git a/components/lib/column/Column.d.ts b/components/lib/column/Column.d.ts index aa630f7a99..efa02aba8e 100644 --- a/components/lib/column/Column.d.ts +++ b/components/lib/column/Column.d.ts @@ -117,6 +117,7 @@ interface ColumnEventParams { } interface ColumnSortParams { + rowData: any; field: string; order: ColumnSortOrderType; } diff --git a/components/lib/datatable/DataTable.js b/components/lib/datatable/DataTable.js index c724101fd4..f123a109f7 100644 --- a/components/lib/datatable/DataTable.js +++ b/components/lib/datatable/DataTable.js @@ -898,14 +898,14 @@ export const DataTable = React.forwardRef((props, ref) => { let value = [...data]; if (columnSortable.current && columnSortFunction.current) { - value = columnSortFunction.current({ field, order }); + value = columnSortFunction.current({ rowData: value, field: field, order: order }); } else { value.sort((data1, data2) => { const value1 = ObjectUtils.resolveFieldData(data1, field); const value2 = ObjectUtils.resolveFieldData(data2, field); - return compareValuesOnSort(value1, value2, order);; + return compareValuesOnSort(value1, value2, order); }); } @@ -933,7 +933,7 @@ export const DataTable = React.forwardRef((props, ref) => { const field = columnField.current; const order = meta ? meta.order : defaultSortOrder; - value = columnSortFunction.current({ field, order }); + value = columnSortFunction.current({ rowData: value, field: field, order: order }); } else { value.sort((data1, data2) => { diff --git a/components/lib/treetable/TreeTable.js b/components/lib/treetable/TreeTable.js index 74f8b78c64..a629eac40c 100644 --- a/components/lib/treetable/TreeTable.js +++ b/components/lib/treetable/TreeTable.js @@ -174,6 +174,7 @@ export const TreeTable = React.forwardRef((props, ref) => { if (columnSortable.current && columnSortable.current === 'custom' && columnSortFunction.current) { value = columnSortFunction.current({ + rowData: value, field: getSortField(), order: getSortOrder() });