@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
17 lines (16 loc) • 520 B
JavaScript
import { useEvent } from "@1771technologies/lytenyte-core/internal";
export function useRowParents(source) {
const rowParents = useEvent((id) => {
const node = source.tree.rowIdToNode.get(id);
if (!node)
return [];
const parents = [];
let current = node.parent;
while (current && current.kind !== "root") {
parents.push(current.row.id);
current = current.parent;
}
return parents.reverse();
});
return rowParents;
}