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

Select all tree when parent is selected. #73

Open
massiws opened this issue Jun 6, 2023 · 5 comments
Open

Select all tree when parent is selected. #73

massiws opened this issue Jun 6, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@massiws
Copy link

massiws commented Jun 6, 2023

In the default props config, when selecting the parent item ONLY parent is selected:
default_props

Version 0.9.0 allow nodes to be selected independently, but this require to click each node, hard work if there are many children.

It would be very useful having an option (something like allTree) to allow add parent AND all its children when the parent is selected.

Thank you.

@dotgourav
Copy link

After the independent node selection feature, this becomes rather important. Although, how would you include this in the UI?

@dipson88
Copy link
Owner

dipson88 commented Jun 8, 2023

@massiws and @dotgourav, I can implement the next behavior: I will show all nodes which have a check icon. So if we click England -> England, London, Chelsea, West End, Brighton.
if we use a situation like on screenshot -> London, Chelsea, West End.
But if I click London off, we will unclick all children, and the input will be empty. It looks strange or not? What do you think?
Because I didn't see a behavior like this before. I see only grouped: true/false behavior, and It was implemented.
What about grouped prop - Show groups in the input and group leafs if all groups selected. You can set this prop to false. And you will see only children without groups name. Can it work for you or not?

@dipson88 dipson88 self-assigned this Jun 8, 2023
@dipson88 dipson88 added the discussion In the disscussion label Jun 8, 2023
@massiws
Copy link
Author

massiws commented Jun 8, 2023

Thank you @dipson88!

Thinking treeselectjs in a search bar maybe could be a real scenario:

  • select London to search items in London and all its districts
  • unselect London means searching in non London cities/districts, so all London districts should be unselected as well.

The grouped option (in my opinion) has a different funcionality.

Hope this make sense.

@massiws
Copy link
Author

massiws commented Jul 6, 2023

@dipson88 any updates?

@dipson88
Copy link
Owner

@massiws, sorry no updates. Your request make sense, but I faced problems, the code became more hard-readable. The problem is related to the input/list communication: when selected 3 nodes (1 parent and 2 children), I unselect the child, but my algorithm checked that parent was still selected, and he runs through the list and checked all children and set partial checked or checked for his parents.
I guess if implement this feature, I need to rewrite the whole algorithm, but It is not a nice decision, or use a hard-readable code, and in the future, it will be hard supported.
Looks like it is a huge task with refactoring, and maybe I need to change the group and isGroupedValue props behavior. isIndependentNodes prop was possible to implement because I just don't use the child/parent algorithm for this behavior.
In the future, I'm going to resolve this task, but now it looks like a too hard to implement.

@dipson88 dipson88 added enhancement New feature or request and removed discussion In the disscussion labels Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants