PDA

View Full Version : [OPEN] [FIXED-248][3.0.x] ux.ProgressBarPager init



hendricd
16 Sep 2009, 2:39 AM
assumes that it is always rendered when declared. In a lazy layout, this.el may not be defined yet when the Progressbar is destroyed by actions initiated elsewhere in the layout.

The fix:


//public
init : function (parent) {

if(parent.displayInfo){
this.parent = parent;
var ind = parent.items.indexOf(parent.displayItem);
parent.remove(parent.displayItem, true);
this.progressBar = new Ext.ProgressBar({
text : this.defaultText,
width : this.progBarWidth,
animate : this.defaultAnimCfg
});

parent.displayItem = this.progressBar;

parent.add(parent.displayItem);
parent.doLayout();
Ext.apply(parent, this.parentOverrides);

this.progressBar.on('render', function(pb) {
pb.el.applyStyles('cursor:pointer');

pb.el.on('click', this.handleProgressBarClick, this);
// Remove the click handler from the
pb.on({
beforeDestroy : function() {
this.progressBar.el.un('click', this.handleProgressBarClick, this);
},
scope : this
});
}, this);

}

},

Condor
16 Sep 2009, 3:34 AM
Which can be even shorter if you use 'mon':

this.progressBar.on('render', function(pb) {
pb.el.applyStyles('cursor:pointer');
pb.mon(pb.el, 'click', this.handleProgressBarClick, this);
}, this, {single: true});

hendricd
16 Sep 2009, 3:48 AM
Yep, it would. ;)

evant
16 Sep 2009, 9:31 PM
Fix applied to svn in rev #5361 for patch release 3.0.3.