View Full Version : [2.2] Slider possible bugs
mysticav
20 Aug 2008, 6:33 PM
Ext Ver 2.2
Condor
20 Aug 2008, 10:34 PM
1. I am unable to reproduce the problem. Can you post an example?
2. The value on vertical click or drag is calculated wrong when minValue != 0. Here is the fix:
Ext.apply(Ext.Slider.Vertical, {
onDrag: function(e){
var pos = this.innerEl.translatePoints(this.tracker.getXY());
var bottom = this.innerEl.getHeight() - pos.top;
this.setValue(this.minValue + Math.round(bottom / this.getRatio()), false);
this.fireEvent('drag', this, e);
},
onClickChange: function(local){
if(local.left > this.clickRange[0] && local.left < this.clickRange[1]){
var bottom = this.innerEl.getHeight() - local.top;
this.setValue(this.minValue + Math.round(bottom / this.getRatio()), undefined, true);
}
}
});
mysticav
20 Aug 2008, 11:27 PM
Thanks for your help.
1. I am unable to reproduce the problem. Can you post an example?
new Ext.Slider({
minValue: -100,
width:235,
maxValue: 100,
listeners:{render:function(){this.setValue(0);}});
As you can see, I'm trying to put the slider indicator at the center. But it is putted at value 16.
Condor
20 Aug 2008, 11:40 PM
You can't set the value in the render event, you can only set it in the afterRender method, e.g.
new Ext.Slider({
width: 235,
minValue: -100,
maxValue: 100,
afterRender: function() {
Ext.Slider.prototype.afterRender.apply(this, arguments);
this.setValue(0);
}
})
but why not simply use:
new Ext.Slider({
width: 235,
minValue: -100,
maxValue: 100,
value: 0
})
mysticav
20 Aug 2008, 11:46 PM
Great. Thank you. All problems solved.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.