Sochettra / dynatree

Automatically exported from code.google.com/p/dynatree
0 stars 0 forks source link

Different behavior for lazy loading a null array for 1.0.3 compared with 0.5.4 #168

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
With the lazy loading, if it returns null array [], there will be an error: 
this.ul is null
jquery.dynatree.js Line 233 

Our quick fix is:
@@ -227,6 +227,9 @@
        if( !cl ){
            return;
        }
+       if (!this.ui) {
+           return;
+       }
        var childLI = this.ul.firstChild;
        for(var i=0, l=cl.length-1; i<l; i++) {
            var childNode1 = cl[i];

Btw, if it returns null, then the result is like what we expected on 0.5.4, the 
node is expanded, the node icon has a minus prefix, after click the minus, it 
will try to load children again. On the 1.0.3, if it loads null array, it seems 
like the node just become a normal node without any expander sign. I'm not sure 
this is expected behavior.

This is our quick fix:
@@ -391,7 +394,8 @@
                return undefined;
            }else if(this.childList.length === 0){
                // Loaded, but response was empty
-               return false;
+               return undefined;
            }else if(this.childList.length === 1 && this.childList[0].isStatusNode()){
                // Currently loading or load error
                return undefined;

We use Firefox 3.6.13.

Original issue reported on code.google.com by keitheis on 17 Dec 2010 at 11:24

GoogleCodeExporter commented 8 years ago
the first one is a bug.

For the second one: the idea was to the allow server to return both:
- an empty array [], meaning "node has no children".
  The parent will be marked as 'loaded' and is not expandable.
- null or undefined, meaning "don't know".
  The parent will remain 'lazy'
Can you live with that?

Original comment by moo...@wwwendt.de on 18 Dec 2010 at 2:38

GoogleCodeExporter commented 8 years ago
Yes, we can. thanks! Just confirmed the right behavior.

Original comment by keitheis on 21 Dec 2010 at 5:48

GoogleCodeExporter commented 8 years ago
Issue 170 has been merged into this issue.

Original comment by moo...@wwwendt.de on 14 Jan 2011 at 7:16

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r453.

Original comment by moo...@wwwendt.de on 14 Jan 2011 at 7:19

GoogleCodeExporter commented 8 years ago

Original comment by moo...@wwwendt.de on 23 Jan 2011 at 8:44

GoogleCodeExporter commented 8 years ago
considered verified

Original comment by moo...@wwwendt.de on 17 Jul 2012 at 4:16

GoogleCodeExporter commented 8 years ago

Original comment by moo...@wwwendt.de on 17 Jul 2012 at 4:19