PDA

View Full Version : [OPEN] [FIXED-41] Container & Toolbar onRender/afterRender split of rendering is wrong



Animal
7 Aug 2009, 12:26 AM
The fix here has caused some other problems:
http://extjs.com/forum/showthread.php?p=370200#post370200

Problems with the doLayout of Windows on show laying out toolbars who's layout property is still a String.

There's something screwy about the order of this stuff. There's a lot of calls do doLayout which probably should not be there. It will take some investigation.

Oh, I think the problem is because Toolbar doesn't call it's superclass's onRender method!

One problem is Toolbar's non-adherence to standards

Toolbar.onRender should create the autoEl specification needed, and leave the regular rendering machinery to do the rest:



Ext.override(Ext.Toolbar, {
onRender : function(ct, position){
if(!this.el){
this.autoEl = this.autoCreate || {
cls: this.toolbarCls + ' x-small-editor'
};
}
Ext.Toolbar.superclass.onRender.apply(this, arguments);
}
});


I don't think it's a problem with Window, I think it could be FormlLayout???

But run examples/form/anchoring.html

The anchoring of the textarea to the boundaries no longer works

elishnevsky
7 Aug 2009, 6:50 AM
I just got the latest version from SVN. The original problem is fixed, but as Animal said, other problems arose. Everytime any toolbar is added to a container, an exception is thrown from Container's doLayout() method.

this.layout.layout is not a function
this.layout.layout();
This is true with regard to any toolbar - top, bottom, paging toolbar...

To reproduce it you can just add a tbar, bbar or fbar config to anything in the code from the first post.

Animal
7 Aug 2009, 8:08 AM
I just got the latest version from SVN. The original problem is fixed, but as Animal said, other problems arose. Everytime any toolbar is added to a container, an exception is thrown from Container's doLayout() method.

this.layout.layout is not a function
this.layout.layout();
This is true with regard to any toolbar - top, bottom, paging toolbar...

To reproduce it you can just add a tbar, bbar or fbar config to anything in the code from the first post.

See above for a fix on that.

Also, the onRender/afterRender split of rendering was wrong.

To replicate the original behaviour (which performed all of it's Container setting up after calling superclass's render), we should just put everything in an afterRender method:

It should be



// private
afterRender : function(){
Ext.Container.superclass.afterRender.apply(this, arguments);
if(this.layout){
if(Ext.isObject(this.layout) && !this.layout.layout){
this.layoutConfig = this.layout;
this.layout = this.layoutConfig.type;
}
if(Ext.isString(this.layout)){
this.layout = new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig);
}
this.setLayout(this.layout);
}

if(this.activeItem !== undefined){
var item = this.activeItem;
delete this.activeItem;
this.layout.setActiveItem(item);
}
if(!this.ownerCt){
// force a layout if no ownerCt is set
this.doLayout(false, true);
}
if(this.monitorResize === true){
Ext.EventManager.onWindowResize(this.doLayout, this, [false]);
}
},

elishnevsky
7 Aug 2009, 8:18 AM
Yes, I applied your override for Toolbar and it fixed the prob. Thanks.
Nige, you should be given write access to SVN :)

Animal
7 Aug 2009, 9:27 AM
That would be dangerous. I'm always in too much of a hurry!

stever
7 Aug 2009, 5:01 PM
As a reference for a simple test case of this bug, just use this example from source:

examples/window/hello.html

evant
9 Aug 2009, 1:53 AM
This is fixed in SVN r5004.