diff --git a/src/components/src/common/data-table/index.tsx b/src/components/src/common/data-table/index.tsx index 13a6ea5080..afdb6d0cd4 100644 --- a/src/components/src/common/data-table/index.tsx +++ b/src/components/src/common/data-table/index.tsx @@ -219,7 +219,7 @@ interface GetRowCellProps { /* * This is an accessor method used to generalize getting a cell from a data row */ -const getRowCell = ( +const defaultGetRowCell = ( {dataContainer, columns, column, colMeta, rowIndex, sortOrder}: GetRowCellProps, formatter ) => { @@ -408,6 +408,7 @@ export interface DataTableProps { sortOrder?: number[] | null; showStats?: boolean; hasCustomScrollBarStyle?: boolean; + getRowCell?: (renderDataCellProps: GetRowCellProps, formatter: any) => string | number; } interface DataTableState { @@ -505,6 +506,7 @@ function DataTableFactory(HeaderCell: ReturnType) { scaleCellsToWidth = debounce(this.doScaleCellsToWidth, 300); renderDataCell = (columns, isPinned, props: DataTableProps) => { + const getRowCell = this.props.getRowCell ?? defaultGetRowCell; return cellInfo => { const {columnIndex, key, style, rowIndex} = cellInfo; const {dataContainer, colMeta} = props;