You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a category A with sub categories B, C and D and another category E with sub categories F, G and B. Now when I check sub category B under category A, the sub category B under category E also gets checked!
The text was updated successfully, but these errors were encountered:
Yes, this is because the checked property only records the node values. If a node value is duplicated by any other node, then you will experience this behavior. The tree therefore requires that each node have a unique value. You can solve this be merely concatenating the parent nodes to the child nodes (e.g. A-B and E-B).
I suppose we could validate all supplied nodes for value uniqueness and throw an error if a duplicate is detected, providing more developer-friendly debugging. Might impact performance, so it probably makes sense to have this as a property that can be disabled (e.g. validateUniqueness).
A more exotic option could also exist, where the node value are automatically concatenated with their parent values, but that would change the resulting tree's values.
I don't think validating nodes for value uniqueness will be a good idea. I can think of many use cases where leaf nodes may have same values but under different categories.
What I ended up doing is pushing the key ({index}-{node.name}) instead of name in the checked array. That works!
I have a category A with sub categories B, C and D and another category E with sub categories F, G and B. Now when I check sub category B under category A, the sub category B under category E also gets checked!
The text was updated successfully, but these errors were encountered: