diff --git a/apps/client/src/widgets/collections/table/index.tsx b/apps/client/src/widgets/collections/table/index.tsx
index b9f6a8d7a..e9c8b8802 100644
--- a/apps/client/src/widgets/collections/table/index.tsx
+++ b/apps/client/src/widgets/collections/table/index.tsx
@@ -56,7 +56,7 @@ export default function TableView({ note, viewConfig, saveConfig }: ViewModeProp
data={rowData}
modules={[ SortModule, FormatModule, InteractionModule, EditModule, ResizeColumnsModule, FrozenColumnsModule, PersistenceModule, MoveColumnsModule, MoveRowsModule, DataTreeModule ]}
footerElement={}
- {...contextMenuEvents}
+ events={contextMenuEvents}
persistence {...persistenceProps}
/>
diff --git a/apps/client/src/widgets/collections/table/tabulator.tsx b/apps/client/src/widgets/collections/table/tabulator.tsx
index 90dee5efb..4ed890aa9 100644
--- a/apps/client/src/widgets/collections/table/tabulator.tsx
+++ b/apps/client/src/widgets/collections/table/tabulator.tsx
@@ -5,16 +5,17 @@ import "../../../../src/stylesheets/table.css";
import { ComponentChildren, RefObject } from "preact";
import { ParentComponent, renderReactWidget } from "../../react/react_utils";
-interface TableProps extends Partial, Pick {
+interface TableProps extends Pick {
tabulatorRef: RefObject;
className?: string;
columns: ColumnDefinition[];
data?: T[];
modules?: (new (table: VanillaTabulator) => Module)[];
footerElement?: ComponentChildren;
+ events?: Partial;
}
-export default function Tabulator({ className, columns, data, modules, tabulatorRef: externalTabulatorRef, footerElement, persistence, persistenceReaderFunc, persistenceWriterFunc, ...events }: TableProps) {
+export default function Tabulator({ className, columns, data, modules, tabulatorRef: externalTabulatorRef, footerElement, events, ...restProps }: TableProps) {
const parentComponent = useContext(ParentComponent);
const containerRef = useRef(null);
const tabulatorRef = useRef(null);
@@ -33,7 +34,7 @@ export default function Tabulator({ className, columns, data, modules, tabula
columns,
data,
footerElement: (parentComponent && footerElement ? renderReactWidget(parentComponent, footerElement)[0] : undefined),
- persistence, persistenceReaderFunc, persistenceWriterFunc
+ ...restProps
});
tabulatorRef.current = tabulator;
@@ -44,7 +45,7 @@ export default function Tabulator({ className, columns, data, modules, tabula
useEffect(() => {
const tabulator = tabulatorRef.current;
- if (!tabulator) return;
+ if (!tabulator || !events) return;
for (const [ eventName, handler ] of Object.entries(events)) {
tabulator.on(eventName as keyof EventCallBackMethods, handler);
@@ -55,7 +56,7 @@ export default function Tabulator({ className, columns, data, modules, tabula
tabulator.off(eventName as keyof EventCallBackMethods, handler);
}
}
- }, Object.values(events));
+ }, Object.values(events ?? {}));
// Change in data.
useEffect(() => { tabulatorRef.current?.setData(data) }, [ data ]);