PDA

View Full Version : core/Element.js anchorTo() broken chain



papasi
13 Mar 2007, 10:37 AM
Hi,

This is minor issue but fixing it makes it a lot more convenient to chain Element's method call like


Ext.get("error").setWidth(300).anchorTo('dialog', 'b-b').hide().show();


Here's a simple patch:


anchorTo : function(el, alignment, offsets, animate, monitorScroll){
var action = function(){
this.alignTo(el, alignment, offsets, animate);
};
Ext.EventManager.onWindowResize(action, this);
var tm = typeof monitorScroll;
if(tm != 'undefined'){
Ext.EventManager.on(window, 'scroll', action, this,
{buffer: tm == 'number' ? monitorScroll : 50});
}
action.call(this); // align immediately
},



anchorTo : function(el, alignment, offsets, animate, monitorScroll){
var action = function(){
return this.alignTo(el, alignment, offsets, animate);
};
Ext.EventManager.onWindowResize(action, this);
var tm = typeof monitorScroll;
if(tm != 'undefined'){
Ext.EventManager.on(window, 'scroll', action, this,
{buffer: tm == 'number' ? monitorScroll : 50});
}
return action.call(this); // align immediately
},

Thanks

papasi
15 Mar 2007, 3:40 PM
Hi,

I notice a few more broken chain in widgets/Components.js while using the form stuff.

focus() , blur(), disable(), enable() etc.

Should be easy to fix.

Thanks.

jack.slocum
19 Mar 2007, 5:50 AM
Chaining is not required, therefore is not a bug. I would be happy to add these things in tho. ;)