BALKANGraph / FamilyTreeJS

Build family tree app with BALKAN FamilyTreeJS library. Family Tree also called a genealogy or a pedigree chart, is a chart representing family relationships in a conventional tree structure.
50 stars 16 forks source link

How do u determine particular node is ancestor or descendant #109

Closed Ullas-A-2000 closed 1 month ago

Ullas-A-2000 commented 1 month ago

suppose on node click or a html class code how do we determine that a card is a ancestor of root user or descendant of root user

ZornitsaPesheva commented 1 month ago

This demo highlight the nodes to the root: https://code.balkan.app/family-tree-js/highlight-selected-node#JS

Ullas-A-2000 commented 1 month ago
Screenshot 2024-05-16 at 2 44 42 PM

suppose yermolai kozolv is root user

his parents should be identified as ancestors and his children shold be identified as descendants

how?

ZornitsaPesheva commented 1 month ago

Please explain in steps the behavior that you need? Click on which node? Then highlight or what and which nodes exactly?

Ullas-A-2000 commented 1 month ago

lets say , my name is jhon and im the root user of tree

jhon has two children ema and may jhon has parents dexter and juliet

when i click on ema i should get descendant when i click on dexter i should get ancestor

similarly dexters parents are also jhons ancestors so when i click on them i should get ancestors and ema's childrens are also jhons descendants so when i click on the i should get descendants

ZornitsaPesheva commented 1 month ago

I have created a code demo for you: https://code.balkan.app/family-tree-js/ancestor-or-descendant#JS

Ullas-A-2000 commented 1 month ago

thanks