Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Function finds the node you are searching for and expand it and its parent.
- *
- * @param {TreeNode} node primeng tree node data
- * @param {string} propField name of the property you are searching for ex: label
- * @param {any} searchValue value you are searching for
- */
- filterExpandRecursive(
- node: TreeNode,
- propField: string,
- searchValue: any
- ): boolean {
- const isMatchSearchField = node[propField] === searchValue;
- node.expanded =
- node.children &&
- node.children.length > 0 &&
- node.children.some(childNode =>
- this.filterExpandRecursive(childNode, propField, searchValue)
- );
- return isMatchSearchField || node.expanded;
- }
Add Comment
Please, Sign In to add comment