Closed ahvahsky2008 closed 10 months ago
How delete node?
<script src="https://balkan.app/js/familytree.js"></script> <div id="tree"/> <script> var family = new FamilyTree(document.getElementById("tree"), { mouseScrool: FamilyTree.action.none, miniMap: true, nodeTreeMenu: true, nodeMenu: { edit: { text: "Edit" }, remove: {text: "delete", onClick: function (sender, args){ var node = family.getNode(sender); family.remove(node); // it doesn't work }}, }, nodeBinding: { field_0: "name" }, nodes: [ { id: 1, pids: [2], name: "Amber McKenzie", gender: "female" }, { id: 2, pids: [1], name: "Ava Field", gender: "male" }, { id: 3, mid: 1, fid: 2, name: "Peter Stevens", gender: "male" } ] }); </script>
Created a code demo for you: https://code.balkan.app/family-tree-js/remove-(delete)-node-from-nodemenu#JS
How delete node?