Hybrid View
-
29 Nov 2011 12:13 PM #1
[CLOSED] Tree: cannot add leaf as a child of leaf node via drag drop: node disappers
[CLOSED] Tree: cannot add leaf as a child of leaf node via drag drop: node disappers
Though it is possible to drag-and-drop leaf node of a tree to another non-leaf node, drag-and-dropping leaf node to another leaf node makes the dragged one disappear after dropping it. The problem is that initially all the leaf nodes have TreeNode#isChildrenRendered property turned off (false). When the leaf is dropped to another leaf node this property does not changes. Thus the implementation of Tree.onAdd works incorrectly:
Code:protected void onAdd(StoreAddEvent<M> event) { ... if (isOrWasAttached()) { // event.getItems().get(0) is a dropped leaf-node // parent is a target leaf-node M parent = store.getParent(event.getItems().get(0)); TreeNode<M> pn = findNode(parent); if (parent == null || (pn != null && pn.isChildrenRendered())) { // we'll never get here because pn.isChildrenRendered() == false ... // rendering the children nodes } ... } ...
-
30 Nov 2011 7:24 PM #2
Thanks for the report - we're looking into it.
-
1 Dec 2011 10:44 AM #3
I'm not quite sure that the isChildrenRendered property is the only reason for this issue, as far as I tried to change it in debugger to true, but that did not produce any effect so far. The internal logic of the widget is a bit sophisticated to me from the first view, but I expect to have time to get into soon.
-
2 Dec 2011 7:10 AM #4
Looks like the problem in store and my data model syncronisation during nodes moving. In Tree.onAdd method:
int parentChildCount = parent == null ? store.getRootCount() : store.getChildCount(parent);
parentChildCount= 1 after dropping one leaf node on another but parent.getChildren() is still empty but should be instead contain node that passed in event.getItems(). Looks I have to look close to the TreeStore and how it use properly.
-
2 Dec 2011 8:48 AM #5
Looks like the bug submission is irrelevant, my error was not keeping my own tree model in sync with TreeStore model.
-
5 Dec 2011 8:53 AM #6
Thanks for the update, and for all of the other testing you've done. Let us know if another bug shows itself - we'll hopefully get those other tree bugs closed out this week.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote