Skip to content

When all children node is selected. Show only the parent's tag #481

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

Closed
HHuuxx opened this issue Apr 2, 2021 · 3 comments
Closed

When all children node is selected. Show only the parent's tag #481

HHuuxx opened this issue Apr 2, 2021 · 3 comments

Comments

@HHuuxx
Copy link

HHuuxx commented Apr 2, 2021

Hi, I have a general inquiry about the functionality of the component.

There is a way where when you select the node that has children and it will automatically select all children node of that node that you have selected and it will show the parent node value as a tag on tag-list and if you unselect a children node then it will unselect the parent node and that leaves the remaining children nodes excluding the children node that you have unselected. This will show all selected children node on the tag list.

What i am trying to do is when all children node is selected on by one, the tags of each children node's value will be changed to the parent's node value. Is there a way to do that?

@mrchief
Copy link
Collaborator

mrchief commented Apr 2, 2021

If you select parent -> parent shows
If you select all children -> all children shows

This was a deliberate design decision to allow for maximum flexibility for different use cases. Depending on requirements, you may want to store one (parent) or all (children) values and this design allows for both cases. In cases where you may want to display one thing when another happens, that can be accomplished with an HoC where the HoC, upon seeing that all children are selected, replaces the data with parent.selected = true and foreach(children) -> selected = false. Bit inconvenient but business decisions like this are better left to user land than component land.

@HHuuxx
Copy link
Author

HHuuxx commented Apr 5, 2021

Thank you for the reply, You have helped me achieved the thing i've been trying to figure out for days now. Kudos to the awesome plugin and to the contributors of this plugin.

@bimix
Copy link

bimix commented Apr 17, 2024

I need to do exactly the opposite. When the parent node is checked, I want all children tags to appear (not the parent tag).

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

No branches or pull requests

3 participants