Issue 277: loadKeyPath exception when key doesn't exist when parent has no children
Status:  Fixed
Owner: ----
Closed:  Jun 2012
Reported by arw...@gmail.com, Feb 13, 2012
What steps will reproduce the problem?
1. Call tree.loadKeyPath with a key that will not be found, but the path from root to parent node is valid. The parent of the node that the key would have matched has no children nodes. 
The exception thrown:
"this.childList is null"
Line: for(var i=0, l=this.childList.length; i < l; i++){

What is the expected output? 
With the code below, I expect to see the tree nodes expanded down to the parent node. The parent will have no expander icon.

parentNode.tree.loadKeyPath(keyPath, function(node, status) {
   if(status == "loaded") {
      node.expand();
   } else if(status == "ok") {
      node.activateSilently();
   }
});

I can catch the exception and call parent.resetLazy(), but the expander icon is present and toggles between closed and lazy.

What do you see instead?
The busy indicator is visible where the expander icon would normally be.

What version of the dynatree and jQuery are you using?
DynaTree 1.2.1rc3, jQuery 1.7.1

On what operating system and browser?
WinXP, Firefox 10, IE7

What DOCTYPE declaration are you using?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



Feb 13, 2012
#1 arw...@gmail.com
My solution is to change this line in the dynatree plugin:
for(var i=0, l=this.childList.length; i < l; i++){

to this:
for(var i=0, l=((this.childList)?this.childList.length:0); i < l; i++){

I welcome a cleaner solution.
Feb 13, 2012
Project Member #2 moo...@wwwendt.de
(No comment was entered for this change.)
Status: Accepted
Labels: Milestone-Release1.2.1
Jun 9, 2012
Project Member #3 moo...@wwwendt.de
 Issue 274  has been merged into this issue.
Jun 9, 2012
Project Member #4 moo...@wwwendt.de
This issue was closed by revision r601.
Status: Fixed