PDA

View Full Version : [CLOSED][3.??] TreeGrid setRootNode method throw "Unknown runtime error" in IE8



Luckyman
13 Jan 2010, 1:45 AM
Error appears when framework try set tableElement.innerHtml to '' (empty string). Red text in following code block. update method in Ext.Element object.


update : function(html, loadScripts, callback){
if (!this.dom) {
return this;
}
html = html || "";

if(loadScripts !== true){
this.dom.innerHTML = html;
if(Ext.isFunction(callback)){
callback();
}
return this;
}


workaround: destroy tree and create new tree instead or try to remove all child nodes.

PS: under FF3.5.6 works fine without any errors.

Jamie Avins
13 Jan 2010, 4:30 PM
Not a great way to remove the nodes, I shudder to think what that does to IE memory. I believe you want a removeAllNodes method to clean it out cleanly?

Condor
14 Jan 2010, 2:32 AM
How did you end up in the Ext.Element.update method anyway?

Did you call treePanel.load()?

Luckyman
14 Jan 2010, 4:10 AM
I use TreeGrid (which extends TreePanel). I didn't find method TreePanel.load() in documentation(Also i didn't find method removeAllNodes in TreeGrid or TreeNode Classes). I simple call setRootNode() to clear tree and reload it with new parameters. I do something like this


TreeGrid.loader.baseParams.id = id;
TreeGrid.setRootNode(new Ext.tree.AsyncTreeNode({text:'Root'}));
and have following stackTrace in IE8
this.dom.innerHTML = html; in Ext.Element.update() throw "Unknown runtime error"
this.innerCt.update(''); in Ext.tree.TreePanel.setRootNode()
node = Ext.ux.tree.TreeGrid.superclass.setRootNode.call(this, node); in Ext.ux.tree.TreeGrid.setRootNode()
TreeGrid.setRootNode(new Ext.tree.AsyncTreeNode({text:'Root'}));

Condor
14 Jan 2010, 4:16 AM
Isn't this already fixed?

What happens if you apply the current Ext 3.1 SVN fixes:

Ext.override(Ext.tree.TreePanel, {
setRootNode : function(node){
Ext.destroy(this.root);
if(!node.render){
node = this.loader.createNode(node);
}
this.root = node;
node.ownerTree = this;
node.isRoot = true;
this.registerNode(node);
if(!this.rootVisible){
var uiP = node.attributes.uiProvider;
node.ui = uiP ? new uiP(node) : new Ext.tree.RootTreeNodeUI(node);
}
if(this.innerCt){
this.clearInnerCt();
this.renderRoot();
}
return node;
},
clearInnerCt : function(){
this.innerCt.update('');
},
renderRoot : function(){
this.root.render();
if(!this.rootVisible){
this.root.renderChildren();
}
},
afterRender : function(){
Ext.tree.TreePanel.superclass.afterRender.call(this);
this.renderRoot();
}
});
Ext.override(Ext.ux.tree.TreeGrid, {
clearInnerCt : function(){
if(Ext.isIE){
var dom = this.innerCt.dom;
while(dom.firstChild){
dom.removeChild(dom.firstChild);
}
}else{
Ext.ux.tree.TreeGrid.superclass.clearInnerCt.call(this);
}
}
});

Luckyman
14 Jan 2010, 4:36 AM
This works fine:).
But I found another solution.
instead set new Root I create TreeLoader with option clearOnLoad : true. and


TreeGrid.loader.baseParams.id = id;
TreeGrid.loader.load(TreeGrid.getRootNode());