| Issue 323: | Moving a newly added node fails if parent is collapsed | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem? 1.have a parent node with existing children 2.expand the parent 3.collapse the parent 4.perform: newNode = parentNode.AddChild 5.Move the newly added node: newNode.move(parentNode,'after') http://jsfiddle.net/Vpv4Q/1/ In jsFiddle Folder 2 and Item 3 are the parent nodes - do step 2 and 3 on one of them. The button will do steps 4 and 5. What is the expected output? What do you see instead? Expected: The newly added node is created and moved correctly. Currently: The move fails and the new nodes are not accessible. What version of the dynatree and jQuery are you using? 1.2.1, 1.7.1 On what operating system and browser? Vista 64bit, Chrome 19 What DOCTYPE declaration are you using? "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" Please provide any additional information below. This is related to issue319 . The fix that was implemented used the following on lines 1813-1816: // Remove from source DOM parent if(this.parent.ul){ this.parent.ul.removeChild(this.li); } Unfortunately the fix doesn't work if the 'this.parent' was an existing parent prior to the new child, it was expanded, but is collapsed when performing the move. This is due to the fact that the ul & li objects are not removed when the parent is collapsed but are just hidden. Therefore the removeChild(this.li) is triggered for the newly created node when it shouldn't be. BTW - if you do the copy/move while the parent is expanded it works fine, i.e. skip step 3. I suggest that instead of checking if the parent is a parent (if(this.parent.ul)), check instead if the this has been rendered (if(this.li)). This will ensure that the removeChild will only be called if this element was previously rendered. Sorry I didn't pick this up prior to 1.2.1 being released :)
Jun 18, 2012
Project Member
#1
moo...@wwwendt.de
Labels:
Milestone-Release1.2.2
Oct 6, 2012
(No comment was entered for this change.)
Labels:
-Milestone-Release1.2.2 Milestone-Release1.2.x
Sep 8, 2013
(No comment was entered for this change.)
Status:
Accepted
Labels: -Milestone-Release1.2.x Milestone-Release1.2.5
Oct 6, 2013
couldn't reproduce with current version; seems to be fixed (please confirm with 1.2.5)
Oct 6, 2013
(No comment was entered for this change.)
Status:
Fixed
|