Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tree-view): add showNode accessor #1844

Merged
merged 1 commit into from
Nov 12, 2023
Merged

feat(tree-view): add showNode accessor #1844

merged 1 commit into from
Nov 12, 2023

Conversation

metonym
Copy link
Collaborator

@metonym metonym commented Nov 12, 2023

Closes #1377

TreeView already exposes an expandNodes accessor.

treeview.expandNodes((node) => {
  return /^IBM/.test(node.text);
});

However, it's currently left to the user to "find" a specific node that they want to expand. The existing accessor also only applied to "expandable" nodes (i.e., nodes with children).

This PR addresses the use case of making an explicit node visible by adding a new accessor showNode. It accepts a node ID, and, if found, will expand, select, and focus the node.

treeview.showNode(nodeId);

Demo

treeview-show-node.mov

@metonym metonym changed the title feat(tree-view): add accessor to show node by id feat(tree-view): add showNode accessor Nov 12, 2023
@metonym metonym marked this pull request as ready for review November 12, 2023 22:14
@metonym metonym merged commit 1ad4e3d into master Nov 12, 2023
3 checks passed
@metonym metonym deleted the treeview-show-node branch November 12, 2023 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Treeview: Display node explicitly
1 participant