PDA

View Full Version : Ext.ux.tree.TreeGrid onResize



mdavis6890
3 Feb 2011, 8:30 PM
I found a bug in Ext.ux.tree.TreeGrid.onResize() which is observable in IE.




onResize : function(w, h) {
Ext.ux.tree.TreeGrid.superclass.onResize.apply(this, arguments);

var bd = this.innerBody.dom;
var hd = this.innerHd.dom;

if(!bd){
return;
}

if(Ext.isNumber(h)){
if(this.body.getHeight(true) > hd.offsetHeight) {
bd.style.height = this.body.getHeight(true) - hd.offsetHeight + 'px';// This is the line that was broken until I wrapped it in this if statement. It seems the error was due to the method being called before rendering and this.body.getHeight(true) returned 0.
}
}

if(Ext.isNumber(w)){
var sw = Ext.num(this.scrollOffset, Ext.getScrollBarWidth());
if(this.reserveScrollOffset || ((bd.offsetWidth - bd.clientWidth) > 10)){
this.setScrollOffset(sw);
}else{
var me = this;
setTimeout(function(){
me.setScrollOffset(bd.offsetWidth - bd.clientWidth > 10 ? sw : 0);
}, 10);
}
}
},

Chau
8 Apr 2011, 3:39 AM
I found a bug in Ext.ux.tree.TreeGrid.onResize() which is observable in IE.




onResize : function(w, h) {
Ext.ux.tree.TreeGrid.superclass.onResize.apply(this, arguments);

var bd = this.innerBody.dom;
var hd = this.innerHd.dom;

if(!bd){
return;
}

if(Ext.isNumber(h)){
if(this.body.getHeight(true) > hd.offsetHeight) {
bd.style.height = this.body.getHeight(true) - hd.offsetHeight + 'px';// This is the line that was broken until I wrapped it in this if statement. It seems the error was due to the method being called before rendering and this.body.getHeight(true) returned 0.
}
}

if(Ext.isNumber(w)){
var sw = Ext.num(this.scrollOffset, Ext.getScrollBarWidth());
if(this.reserveScrollOffset || ((bd.offsetWidth - bd.clientWidth) > 10)){
this.setScrollOffset(sw);
}else{
var me = this;
setTimeout(function(){
me.setScrollOffset(bd.offsetWidth - bd.clientWidth > 10 ? sw : 0);
}, 10);
}
}
},




I am having the same problem in IE8. I haven't digged through the call stack, since it takes forever in IE Dev tools. I have tried to set a height on the tree (even though I have a fit-layout on the parent container) but it doesn't help.

It could be nice to get a fix so I don't need to maintain this negative-height-check my self :)