Content
View differences
Updated by Parimal Satyal about 1 year ago
# Problem
* Our new `TreeView` component allows the select variant `multiple` which renders checkboxes in front of each item
* Depending on a value (`select_strategy: :descendants`), there is some logic whether the children should automatically be selected when a parent node is selected
* Independent of that value, the children are not automatically shown when a parent is selected
* There is a dynamic loading strategy where children are only loaded when a parent node is opened
**Question: What should happen when a parent node is checked but the children are not loaded yet because of the dynamic loading strategy?**
<br>
# Considered Options
##
**A) Load the children as soon as the parent is clicked**
Pros:
* Given the value `select_strategy: :descendants` is set, this will create the correct data set that the user wants
Cons
* Can be really expensive, since the whole sub-tree of that node would need to be loaded
* Since the children are not automatically shown, it is hard for users to now whether they are selected or not
**B) Do not load the children and only check the parent**
Pros:
* Cheap solution
Cons
* Can creaet unwanted data for users
* Since the children are not automatically shown, it is hard for users to now whether they are selected or not
**C) Do not allow dynamic loading strategy in combination with the select variant** `multiple` `**multiple**`
Pros:
* Cheap solution
* We currently have not identified the no need for a TreeView with dynamic loading and multi select
Cons
* Might bite us bight us, when we discover the need for dynamic loading and multi select
# Decision
For now, we go with option C and don't allow multi-select for dynamically loaded trees. This buys us time. If we discover the need later, we will revisit this discussion.
* Our new `TreeView` component allows the select variant `multiple` which renders checkboxes in front of each item
* Depending on a value (`select_strategy: :descendants`), there is some logic whether the children should automatically be selected when a parent node is selected
* Independent of that value, the children are not automatically shown when a parent is selected
* There is a dynamic loading strategy where children are only loaded when a parent node is opened
**Question: What should happen when a parent node is checked but the children are not loaded yet because of the dynamic loading strategy?**
<br>
# Considered Options
##
**A) Load the children as soon as the parent is clicked**
Pros:
* Given the value `select_strategy: :descendants` is set, this will create the correct data set that the user wants
Cons
* Can be really expensive, since the whole sub-tree of that node would need to be loaded
* Since the children are not automatically shown, it is hard for users to now whether they are selected or not
**B) Do not load the children and only check the parent**
Pros:
* Cheap solution
Cons
* Can creaet unwanted data for users
* Since the children are not automatically shown, it is hard for users to now whether they are selected or not
**C) Do not allow dynamic loading strategy in combination with the select variant** `multiple`
Pros:
* Cheap solution
* We currently have not identified the
Cons
* Might bite us
# Decision
For now, we go with option C and don't allow multi-select for dynamically loaded trees. This buys us time. If we discover the need later, we will revisit this discussion.