[2.2][CLOSED] Bug in Ext.Panel.onRender
Line 687 - 693:
Code:
if(this.tools){
var ts = this.tools;
this.tools = {};
this.addTool.apply(this, ts);
}else{
this.tools = {};
}
Notice the line
Code:
this.addTool.apply(this, ts);
Obviously, Function.prototype.apply expects the second argument to be of type Array, but instead an object is passed, which will throw an error.
Changing the line
Code:
this.addTool.apply(this, ts);
to
Code:
this.addTool.apply(this, [ts]);
Will fix this issue.
HTHATINCW
Thorsten
No, really there is a bug in here
I've been chasing down a problem in ExtJS 3.3.1, and it appears to be the same as the one reported here, except that it's the other half of the if statement.
In ExtJS 3.3.1, the code looks like this:
Code:
if(this.tools){
ts = this.tools;
this.elements += (this.header !== false) ? ',header' : '';
}
this.tools = {};
If you start with this.tools==undefined, then after the onRender code executes, this.tools will be equal to {}. If you ever need to re-render the object again (for example, if you change the contents of the panel, or even change its layout manager) then this.tools will be an illegal value!
Note that setting the config option for tools to "[]" doesn't help, because we are really talking about a panel that doesn't have a toolbar.
I'll keep looking to see if there is another discussion of this issue, but in the meantime, I thought it would be useful to append to this one.