Opened 10 years ago
Closed 10 years ago
#14566 closed enhancement (duplicate)
Tree: support loops in data and autoExpand=true
Reported by: | acabler | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Dijit | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I have a tree with items that may be duplicated in different places in the tree. The problem is that when there is any recursion, the tree expands indefinitely. I tried to fix this both by returning false for mayHaveChildren and setting isExpandable to false when recursion is detected, but this did not fix the problem.
In line 328 of dijit/Tree.js, a check is made to decide whether or not to expand the node. I was able to fix my tree by adding a check for isExpandable here. This seems to be a safe thing to do and I thought it may be useful for others.
Change History (5)
comment:1 Changed 10 years ago by
Component: | General → Dijit |
---|---|
Summary: | Tree Auto Expand Problem → Tree: support loops in data and autoExpand=true |
Type: | defect → enhancement |
comment:2 Changed 10 years ago by
I agree that this is a corner case, but there seems little harm in checking the expandable flag of a node before expanding it.
comment:3 Changed 10 years ago by
I don't know, setting isExpandable to false for a node that is actually expandable sounds like it will lead to problems.
comment:4 Changed 10 years ago by
Bill,
I just verified that this was fixed in 1.7.1. The state of the node is now checked instead of the item before expanding it.
if(this.tree.autoExpand || this.tree._state(node)){ //in 1.6 it was _state(item) defs.push(tree._expandNode(node)); }
You can close this if you like.
Thanks,
Adam
comment:5 Changed 10 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
OK good, I'll close it then. Looks like you are referring to #12800 so I'll close this as a duplicate of that, although they don't seem quite the same.
Umm, so you are saying that you have a loop so that there's a Tree like:
And then furthermore you are setting autoExpand=true as an initialization parameter?
Such Trees aren't supported, especially when setting autoExpand=true.
I guess we could add checks for this corner case but I haven't heard of many people with such data structures so I don't see a reason to add code for it. Are others having this problem?