lowcoder icon indicating copy to clipboard operation
lowcoder copied to clipboard

[Bug]: Tree Component Auto Expand behavior is not consistent

Open jnewman-eti opened this issue 1 year ago • 1 comments
trafficstars

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" image

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. image

Expected Behavior

Two options:

  1. When default expand is set to true, ensure this behavior remains consistent when data changes.
  2. 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

  1. Create a tree component, a temporary state variable, and a js query.

  2. Set the Tree Data property to {{state1.value}}

  3. On the tree component, set "Default Expand All Nodes" to true.

  4. 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" } ]

  5. 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

jnewman-eti avatar Dec 27 '23 20:12 jnewman-eti

Thank you very much for this truly good Description. We will work soon on it!

FalkWolsky avatar Jan 06 '24 13:01 FalkWolsky

@jnewman-eti Thank you for you patience. This issue is resolved and will be release in version 2.4.1

raheeliftikhar5 avatar Jun 13 '24 07:06 raheeliftikhar5