Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[feat] Table widged: pass getRowCell as prop (#2349)

Igor Dykhtaa9181f69e7c5
diff --git a/src/components/src/common/data-table/index.tsx b/src/components/src/common/data-table/index.tsx
index 41ab2f898..286a1b556 100644
--- a/src/components/src/common/data-table/index.tsx
+++ b/src/components/src/common/data-table/index.tsx
@@ -218,7 +218,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
) => {
@@ -407,6 +407,7 @@ export interface DataTableProps {
sortOrder?: number[] | null;
showStats?: boolean;
hasCustomScrollBarStyle?: boolean;
+ getRowCell?: (renderDataCellProps: GetRowCellProps, formatter: any) => string | number;
}
interface DataTableState {
@@ -504,6 +505,7 @@ function DataTableFactory(HeaderCell: ReturnType<typeof HeaderCellFactory>) {
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;