How to create a FamilyTree JS programmatically
There are number of functions to create FamilyTree JS programmatically
addParentNode
adds a parent nodefamily.addParentNode(1, "mid", { id: 0, name: "Amber McKenzie's mother", gender: "female" } );
addPartnerNode
adds a partner nodefamily.addPartnerNode( { id: 6, pids: [3], name: "Peter Stevens's wife", gender: "female" } );
addPartnerAndParentNodes
adds a parent which is partner to the other parentfamily.addPartnerAndParentNodes( 1, [3], { id: 2, pids: [1], name: "Ava Field", gender: "male" } );
addChildNode
adds a child node of two partnersfamily.addChildNode( { id: 6, mid: 1, fid: 2, name: "Amber and Ava's child", gender: "female" } );
addChildAndPartnerNodes
adds a partner snd a child nodesfamily.addChildAndPartnerNodes(3, { id: 7, mid: 6, fid: 3, name: "Peter's child", gender: "female" }, { id: 6, pids: [3], tipe: "mid", name: "Peter's wife", gender: "female" } );
removeNode
delete a node from the treefamily.removeNode(3);