fix(collections/table): react to tree state changes (closes #7204)

This commit is contained in:
Elian Doran 2025-10-06 18:49:11 +03:00
parent b2174549c7
commit fa7575ed00
No known key found for this signature in database

View File

@ -16,7 +16,7 @@ interface TableProps<T> extends Omit<Options, "data" | "footerElement" | "index"
footerElement?: string | HTMLElement | JSX.Element; footerElement?: string | HTMLElement | JSX.Element;
} }
export default function Tabulator<T>({ className, columns, data, modules, tabulatorRef: externalTabulatorRef, footerElement, events, index, ...restProps }: TableProps<T>) { export default function Tabulator<T>({ className, columns, data, modules, tabulatorRef: externalTabulatorRef, footerElement, events, index, dataTree, ...restProps }: TableProps<T>) {
const parentComponent = useContext(ParentComponent); const parentComponent = useContext(ParentComponent);
const containerRef = useRef<HTMLDivElement>(null); const containerRef = useRef<HTMLDivElement>(null);
const tabulatorRef = useRef<VanillaTabulator>(null); const tabulatorRef = useRef<VanillaTabulator>(null);
@ -36,6 +36,7 @@ export default function Tabulator<T>({ className, columns, data, modules, tabula
data, data,
footerElement: (parentComponent && isValidElement(footerElement) ? renderReactWidget(parentComponent, footerElement)[0] : undefined), footerElement: (parentComponent && isValidElement(footerElement) ? renderReactWidget(parentComponent, footerElement)[0] : undefined),
index: index as string | number | undefined, index: index as string | number | undefined,
dataTree,
...restProps ...restProps
}); });
@ -45,7 +46,7 @@ export default function Tabulator<T>({ className, columns, data, modules, tabula
}); });
return () => tabulator.destroy(); return () => tabulator.destroy();
}, []); }, [ dataTree ] );
useEffect(() => { useEffect(() => {
const tabulator = tabulatorRef.current; const tabulator = tabulatorRef.current;