diff --git a/src/components/table/Table.tsx b/src/components/table/Table.tsx index 23b29c8..c568fc2 100644 --- a/src/components/table/Table.tsx +++ b/src/components/table/Table.tsx @@ -3,7 +3,7 @@ import { AgGridReact } from 'ag-grid-react'; import 'ag-grid-community/styles/ag-grid.css'; // Core CSS import 'ag-grid-community/styles/ag-theme-quartz.css'; // Theme import './table.css'; -import { useEffect, useMemo, useState } from 'react'; +import { useEffect, useMemo, useRef, useState } from 'react'; import { ClientCellRenderer } from './cellRenderers/ClientCellRenderer'; import { CompanyCellRenderer } from './cellRenderers/CompanyCellRenderer'; import { HistoryCellRenderer } from './cellRenderers/HistoryCellRenderer'; @@ -57,7 +57,7 @@ export const TableCore = () => { return stringA.localeCompare(stringB); } }; - + const tableRef = useRef(null); useEffect(() => { setRowData(appState?.clientProfileUpdates); @@ -177,6 +177,9 @@ export const TableCore = () => { key: el, }; }, + cellRendererParams: { + tableRef: tableRef, + }, }, ]; }); @@ -194,6 +197,7 @@ export const TableCore = () => { return ( { +export const HistoryCellRenderer = ({ + value, + tableRef, +}: { + value: { row: any; key: string }; + tableRef: React.RefObject; +}) => { const appState = useAppState(); - const [loading, setLoading] = useState(false); const [updateHistory, setUpdateHistory] = useState([]); @@ -132,10 +137,34 @@ export const HistoryCellRenderer = ({ value }: { value: { row: any; key: string ) : ( <> )} - + {loading ? : } - + ({