diff --git a/src/plugins/vis_type_table/public/components/table_vis_component.tsx b/src/plugins/vis_type_table/public/components/table_vis_component.tsx
index 60f4fddf5d93..82282f9e715a 100644
--- a/src/plugins/vis_type_table/public/components/table_vis_component.tsx
+++ b/src/plugins/vis_type_table/public/components/table_vis_component.tsx
@@ -50,8 +50,7 @@ export const TableVisComponent = ({
return (({ rowIndex, columnId }) => {
const rawContent = sortedRows[rowIndex][columnId];
const colIndex = columns.findIndex((col) => col.id === columnId);
- const column = columns[colIndex];
- const htmlContent = column.formatter.convert(rawContent, 'html');
+ const htmlContent = columns[colIndex].formatter.convert(rawContent, 'html');
const formattedContent = (
/*
* Justification for dangerouslySetInnerHTML:
@@ -119,8 +118,7 @@ export const TableVisComponent = ({
const footerCellValue = visConfig.showTotal
? ({ columnId }: { columnId: any }) => {
- const colIndex = columns.findIndex((col) => col.id === columnId);
- return columns[colIndex]?.formattedTotal || null;
+ return columns.find((col) => col.id === columnId)?.formattedTotal || null;
}
: undefined;
diff --git a/src/plugins/vis_type_table/public/components/table_vis_grid_columns.tsx b/src/plugins/vis_type_table/public/components/table_vis_grid_columns.tsx
index e7265d9c9237..77d496a1eb43 100644
--- a/src/plugins/vis_type_table/public/components/table_vis_grid_columns.tsx
+++ b/src/plugins/vis_type_table/public/components/table_vis_grid_columns.tsx
@@ -16,7 +16,7 @@ export const getDataGridColumns = (
cols: FormattedColumn[],
table: Table,
event: IInterpreterRenderHandlers['event'],
- columnsWidth: ColumnWidth[]
+ columnWidths: ColumnWidth[]
) => {
const filterBucket = (rowIndex: number, columnIndex: number, negate: boolean) => {
const foramttedColumnId = cols[columnIndex].id;
@@ -117,7 +117,7 @@ export const getDataGridColumns = (
]
: undefined;
- const initialWidth = columnsWidth.find((c) => c.colIndex === colIndex);
+ const initialWidth = columnWidths.find((c) => c.colIndex === colIndex);
const dataGridColumn: EuiDataGridColumn = {
id: col.id,
diff --git a/src/plugins/vis_type_table/public/components/table_vis_options.tsx b/src/plugins/vis_type_table/public/components/table_vis_options.tsx
index e4cebe69fb4f..ff99972c83a5 100644
--- a/src/plugins/vis_type_table/public/components/table_vis_options.tsx
+++ b/src/plugins/vis_type_table/public/components/table_vis_options.tsx
@@ -132,6 +132,7 @@ function TableOptions({
paramName="showTotal"
value={stateParams.showTotal}
setValue={setValue}
+ data-test-subj="showTotal"
/>
);
diff --git a/src/plugins/vis_type_table/public/types.ts b/src/plugins/vis_type_table/public/types.ts
index f77abe78a1fa..225bdedb9a1d 100644
--- a/src/plugins/vis_type_table/public/types.ts
+++ b/src/plugins/vis_type_table/public/types.ts
@@ -80,5 +80,5 @@ export interface TableUiState {
sort: SortColumn;
setSort: (sort: SortColumn) => void;
width: ColumnWidth[];
- setWidth: (columnsWidth: ColumnWidth[]) => void;
+ setWidth: (columnWidths: ColumnWidth[]) => void;
}
diff --git a/src/plugins/vis_type_vega/public/vega_inspector/components/inspector_data_grid.tsx b/src/plugins/vis_type_vega/public/vega_inspector/components/inspector_data_grid.tsx
index bf0eb584fc58..e5cd924e6e48 100644
--- a/src/plugins/vis_type_vega/public/vega_inspector/components/inspector_data_grid.tsx
+++ b/src/plugins/vis_type_vega/public/vega_inspector/components/inspector_data_grid.tsx
@@ -110,26 +110,26 @@ export const InspectorDataGrid = ({ columns, data, dataGridAriaLabel }: Inspecto
}, [gridData, pagination]);
// Resize
- const [columnsWidth, setColumnsWidth] = useState>({});
+ const [columnWidths, setColumnWidths] = useState>({});
const onColumnResize: EuiDataGridProps['onColumnResize'] = useCallback(
({ columnId, width }) => {
- setColumnsWidth({
- ...columnsWidth,
+ setColumnWidths({
+ ...columnWidths,
[columnId]: width,
});
},
- [columnsWidth]
+ [columnWidths]
);
return (
{
- if (columnsWidth[column.id]) {
+ if (columnWidths[column.id]) {
return {
...column,
- initialWidth: columnsWidth[column.id],
+ initialWidth: columnWidths[column.id],
};
}
return column;