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

Easy api to prevent nodes from being selectable #56

Open
jameskerr opened this issue Oct 28, 2022 · 2 comments · May be fixed by #169
Open

Easy api to prevent nodes from being selectable #56

jameskerr opened this issue Oct 28, 2022 · 2 comments · May be fixed by #169

Comments

@jameskerr
Copy link
Member

This is possible today, but maybe we could make an easier api.

Today, you'd make a custom RowRenderer and NodeRenderer. Then in there, you'd prevent selection if that node meets a certain criteria. An Tree Prop would make it all easier.

@boriskor
Copy link

First of all, thank you for such a great library! 🙏

I think the tree prop is very important. The solution you describe won't cover all the cases, only the mouse selection.

  1. The user can still select the "unselectable" nodes by keyboard. This can be solved by using custom Container, but then the user needs to reimplement most of the keyboard functionality by himself...
  2. TreeApi calls this.select() in a few places, in create and in focus. I currently can't think of some nice workaround for this.

So, the API for preventing nodes selection is crucial, maybe disableSelect?: string | boolean | BoolFunc<T>, in the spirit of disableEdit/disableDrag. WDYT?

@jameskerr
Copy link
Member Author

Yes, that is a good point. I think your proposed api is sound.

@boriskor boriskor linked a pull request Jul 31, 2023 that will close this issue
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 a pull request may close this issue.

2 participants