Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Table widget: pass getRowCell as prop #2349

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/src/common/data-table/index.tsx
Expand Up @@ -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
) => {
Expand Down Expand Up @@ -408,6 +408,7 @@ export interface DataTableProps {
sortOrder?: number[] | null;
showStats?: boolean;
hasCustomScrollBarStyle?: boolean;
getRowCell?: (renderDataCellProps: GetRowCellProps, formatter: any) => string | number;
}

interface DataTableState {
Expand Down Expand Up @@ -505,6 +506,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;
Expand Down