Add filter

I’m facing some difficulties to filter the level of Family Tree by after i retrieved data from database and displayed in Diagram. What i want is add button to do filtering, like add “Display Single Level Only”, “Display all Level”, “User defined Level” button. Is there any way to do this? Thanks.

Are you assuming the whole tree is present in the diagram, or are you asking about incrementally growing the tree as needed, as Incremental Tree demonstrates?

I would recursively walk the tree, keeping track of the level, and set Node.isTreeExpanded = (level > 0). Stop the recursion when level is zero, or else recurse on the Node.findTreeChildrenNodes() with a decremented level.

With version 1.2 there are two useful methods that take a parameter for number of levels: Node.collapseTree and Node.expandTree.

Note that those methods do not perform any transaction, so you might need to.