lowcoder
lowcoder copied to clipboard
[Bug]: Tree Component Auto Expand behavior is not consistent
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
When a tree has "Default Expand All Nodes" enabled, it is expected that all nodes will be expanded. However, this does not work when adding data to the tree. Since we do not have access to modify the "expanded" property on the tree, we cannot instruct the tree to expand the newly added data.
Initial tree data before data added, with "default expand all nodes set to true"
Tree data after adding a new item to the tree. New item is not expanded. There is no way to expand it without clicking on it.
Expected Behavior
Two options:
- When default expand is set to true, ensure this behavior remains consistent when data changes.
- Allow the developer to set the expanded property to add/remove expanded nodes programmatically.
Option 2 will be much easier to implement, as option 1 has some tricky use cases depending on the state of the tree.
Steps to reproduce
-
Create a tree component, a temporary state variable, and a js query.
-
Set the Tree Data property to {{state1.value}}
-
On the tree component, set "Default Expand All Nodes" to true.
-
temporary state variable contents:
[ { "label": "Asia", "value": "asia", "children": [ { "label": "China", "value": "china", "children": [ { "label": "Beijing", "value": "beijing" }, { "label": "Shanghai", "value": "shanghai" } ] }, { "label": "Japan", "value": "japan" } ] }, { "label": "Europe", "value": "europe", "disabled": true, "children": [ { "label": "England", "value": "england" }, { "label": "France", "value": "france", "checkable": false }, { "label": "Germany", "value": "germany", "disableCheckbox": true } ] }, { "label": "North America", "value": "northAmerica" } ] -
js query contents:
var x = [...tree1.treeData]; x.push({"label": "Test", "value": "TestVal", "children": [ { "label": "Beijing", "value": "beijing" }, { "label": "Shanghai", "value": "shanghai" } ]}); state1.setValue(x);
Environment
No response
Additional Information
No response
Thank you very much for this truly good Description. We will work soon on it!
@jnewman-eti Thank you for you patience. This issue is resolved and will be release in version 2.4.1