mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(collections/table): react to tree state changes (closes #7204)
This commit is contained in:
parent
b2174549c7
commit
fa7575ed00
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user