PDA

View Full Version : [FIXED-673][ext-3.1.2] AsyncTreeNode.reload() error: this.parentNode is null



matthias8283
2 Mar 2010, 4:05 AM
Hi ExtJS-Team,

when calling the reload method of an async tree node I'm getting a javascript error (this.parentNode is null).

After analyzing the code I think I have found a possible cause for this error:




// Ext.data.Node
remove : function(destroy){
this.parentNode.removeChild(this, destroy);
return this;
},


// AsyncTreeNode
reload : function(callback, scope){
this.collapse(false, false);
while(this.firstChild){
this.removeChild(this.firstChild).destroy();
}
this.childrenRendered = false;
this.loaded = false;
if(this.isHiddenRoot()){
this.expanded = false;
}
this.expand(false, false, callback, scope);
}

I think the remove method from Ext.data.Node gets called twice because the removeChild() method call (inside the reload() method) internally destroys the child node, so the explicit call to destroy() should not be necessary.

Please let me know if you could reproduce this error.

Thanks & Regards,
Matthias Reischenbacher

ajpfister
2 Mar 2010, 6:45 AM
I've noticed the same thing. Maybe this can help?

Ext version tested:


Ext 3.1.2



Adapter used:


ext



css used:


only default ext-all.css

Browser versions tested against:


IE7
FF 3.5.8 (firebug 1.5.2 installed)
Chrome 4.1.249.1021

Operating System:


WinXP Pro


Description:


See above


Test Case:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../ext-3.1.2/resources/css/ext-all.css" rel="stylesheet" type="text/css" />

<title></title>

<script src="../ext-3.1.2/adapter/ext/ext-base.js" type="text/javascript"></script>
<script src="../ext-3.1.2/ext-all-debug.js" type="text/javascript"></script>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = '../ext-3.1.2/resources/images/default/s.gif';

Ext.onReady(function() {

var tree = new Ext.tree.TreePanel({
renderTo: 'tree',
title: 'My Task List',
height: 300,
width: 400,
useArrows: true,
autoScroll: true,
animate: true,
enableDD: true,
containerScroll: true,
rootVisible: false,
frame: true,
root: {
nodeType: 'async'
},

// auto create TreeLoader
dataUrl: 'check-nodes.json',

listeners: {
'checkchange': function(node, checked) {
if (checked) {
node.getUI().addClass('complete');
} else {
node.getUI().removeClass('complete');
}
}
},

buttons: [{
text: 'reload',
handler: function() {
tree.getRootNode().reload();
}
}]
});

tree.getRootNode().expand(true);

});
</script>
</head>
<body>
<div id="tree"></div>
</body>
</html>


Steps to reproduce the problem:


click the 'reload' button


The result that was expected:


The tree should reload


The result that occurs instead:


The tree does not reload and throws an error


Debugging already done:


none



Possible fix:


not provided

Jamie Avins
2 Mar 2010, 10:34 AM
This is fixed in SVN 6181.