Open frankbracq opened 1 month ago
Hi,
Could you show me an example of code to add the ‘selected’ tag to a node?
Hereafter an extract of the code I'm uisng
reaction( () => configStore.config.root, (rootId) => { if (!initializing) { if (!family) { initializeFamilyTree(); } const oldestAncestorId = getOldestAncestorOf(rootId, "both"); family.config.roots = [oldestAncestorId]; console.log('Family', family);
**// sample code to be implemented here** // addFocusedTag(nodeData); family.draw(); } }
);
function addFocusedTag(node) { if (!node.tags.includes('selected')) { node.tags.push('selected'); } }
Thanks in advance
Please check if this is what you need to achieve: https://code.balkan.app/org-chart-js/select-and-deselect-on-node-click-only#JS
Hi,
Could you show me an example of code to add the ‘selected’ tag to a node?
Hereafter an extract of the code I'm uisng
reaction( () => configStore.config.root, (rootId) => { if (!initializing) { if (!family) { initializeFamilyTree(); } const oldestAncestorId = getOldestAncestorOf(rootId, "both"); family.config.roots = [oldestAncestorId]; console.log('Family', family);
);
function addFocusedTag(node) { if (!node.tags.includes('selected')) { node.tags.push('selected'); } }
Thanks in advance