diff --git a/packages/grafana-ui/src/components/Table/HeaderRow.tsx b/packages/grafana-ui/src/components/Table/HeaderRow.tsx index 2c59d649eaf..e6389620b5c 100644 --- a/packages/grafana-ui/src/components/Table/HeaderRow.tsx +++ b/packages/grafana-ui/src/components/Table/HeaderRow.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { HeaderGroup, Column } from 'react-table'; -import { DataFrame, Field } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { useStyles2 } from '../../themes'; @@ -13,12 +12,11 @@ import { getTableStyles, TableStyles } from './styles'; export interface HeaderRowProps { headerGroups: HeaderGroup[]; - data: DataFrame; showTypeIcons?: boolean; } export const HeaderRow = (props: HeaderRowProps) => { - const { headerGroups, data, showTypeIcons } = props; + const { headerGroups, showTypeIcons } = props; const e2eSelectorsTable = selectors.components.Panels.Visualization.Table; const tableStyles = useStyles2(getTableStyles); @@ -35,7 +33,7 @@ export const HeaderRow = (props: HeaderRowProps) => { role="row" > {headerGroup.headers.map((column: Column, index: number) => - renderHeaderCell(column, tableStyles, data.fields[index], showTypeIcons) + renderHeaderCell(column, tableStyles, showTypeIcons) )} ); @@ -44,8 +42,9 @@ export const HeaderRow = (props: HeaderRowProps) => { ); }; -function renderHeaderCell(column: any, tableStyles: TableStyles, field?: Field, showTypeIcons?: boolean) { +function renderHeaderCell(column: any, tableStyles: TableStyles, showTypeIcons?: boolean) { const headerProps = column.getHeaderProps(); + const field = column.field ?? null; if (column.canResize) { headerProps.style.userSelect = column.isResizing ? 'none' : 'auto'; // disables selecting text while resizing diff --git a/packages/grafana-ui/src/components/Table/Table.tsx b/packages/grafana-ui/src/components/Table/Table.tsx index 19ff9f3df6c..30e72a5636d 100644 --- a/packages/grafana-ui/src/components/Table/Table.tsx +++ b/packages/grafana-ui/src/components/Table/Table.tsx @@ -283,7 +283,7 @@ export const Table: FC = memo((props: Props) => {
- {!noHeader && } + {!noHeader && } {itemCount > 0 ? (