#638 closed defect (fixed)
Adding child to tree using RPC control causes double-addition
Reported by: | Owned by: | ilia | |
---|---|---|---|
Priority: | blocker | Milestone: | |
Component: | Widgets | Version: | 0.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I've got an RPC controlled tree based off of this example http://archive.dojotoolkit.org/nightly/tests/widget/tree/test_Tree_7.html only running a real database backend. The problem is that if I create a child on a node that has not yet been expanded, I see the created node twice--once from when it is initially created, and another from when the node is expanded.
Using nightly for 04/20
Change History (5)
comment:1 Changed 15 years ago by
Milestone: | → 0.3.1 |
---|---|
Priority: | normal → highest |
severity: | normal → major |
Version: | 0.2 → 0.3 |
comment:2 Changed 15 years ago by
Milestone: | 0.3.1 → 0.4 |
---|---|
Owner: | changed from anonymous to ilia |
Ilia, what do you think? I'm not sure if this is a bug or not.
comment:3 Changed 15 years ago by
uh! I've introduced a new bug with my "patch". Therefore a new "patch":
doCreateChild: function(parent, index, data, callObj, callFunc) { /* load nodes into newParent in sync mode, if needed, first */ if (parent.state == parent.loadStates.UNCHECKED) { this.loadRemote(parent, true); this.expand(parent); if (callFunc) { callFunc.apply(callObj, [/*newChild*/]); } // there is nothing to return :-( } else { return dojo.widget.TreeBasicController.prototype.doCreateChild.apply(this, arguments); } }
Disadvantage is that there is no new node to return if parent loads it's children and no new node to call callback fn with. I see 2 methods to workaround this:
- when loadRemote, do not load newly created node (in this case there would have to be some parameter to loadRemote denoting the new node)
- load also newly created node, but don't create it with ...doCreateChild.apply
comment:4 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch accepted into stable Tree. TreeV3 does not seem to have such problem
this problem is still there in dojo 0.3.1 !
cause: before adding a newly created node to its parent, the parent is expanded for the first time and therefore all its children are loaded from server already including newly created node. This cause node duplication.
Here is a small "patch" that has helped me (please add it to new milestone after your additional corretions): replaced method in TreeLoadingController?.js: