PDA

View Full Version : [FIXED-397][3.1] Ext.ProgressBar updateProgress



nctag
22 Dec 2009, 12:24 AM
Ext Rev: 5706

I just wrote an override because my script crashes all the time.


Ext.override( Ext.ProgressBar, {
updateProgress : function(value, text, animate){
this.value = value || 0;
if(text){
this.updateText(text);
}
if(this.rendered && !this.isDestroyed){ //TODO:
var w = Math.floor(value*this.el.dom.firstChild.offsetWidth);
this.progressBar.setWidth(w, animate === true || (animate !== false && this.animate));
if(this.textTopEl){
//textTopEl should be the same width as the bar so overflow will clip as the bar moves
this.textTopEl.removeClass('x-hidden').setWidth(w);
}
}
this.fireEvent('update', this, value, text);
return this;
}
});

I just corrected the if( this.rendered ) to if (this.rendered && !this.isDestroyed).

When did I run into? I just removed a ProgressBar after I called the wait()-method with an infinit duration. Certainly I called the pbar.reset()-method before but without some affect.

Then I stept into the code and I saw that there is only a check wheter de component is rendered but what's about when the component isDestroyed already?

Reproducing Code:


var pbar = new Ext.ProgressBar({
width:512
});
var panel = new Ext.Panel({
border:false,
items:[pbar]
});

pbar.wait({ interval:500,
increment:5
});

pbar.reset();
panel.remove( pbar );
panel.doLayout();


Thanks for any feedback.~o)

evant
22 Dec 2009, 1:34 AM
Fix applied to svn in rev #5806 for patch release 3.1.1.