PDA

View Full Version : I need a mouseup even in slider control



silk
9 Feb 2011, 11:51 AM
Change or dragend event is not ideal for me because "change" fires too often, and "dragend" only fires when dragging, not when clicked.
So I need a mouseup event which fires upon release of mouse, and fires upon end of drag or click.

Well, did not find any implementation and I failed to extend the component or add the event.

So far the only solution I got is to use getEl() after the slider is rendered, then add mouseup listener to it, like this:
var myslider = new Ext.Slider(....)
then after it is rendered:
myslider.getEl().on('mouseup',function(){...})

But I don't think this is the right way, it should be taken care of by the component, but I failed to do so.

Hint or suggestions or even sample code please.

silk
9 Feb 2011, 3:14 PM
Here is what I did, not sure if it is the best way, anyway it works for me.


NS.Slider = Ext.extend(Ext.Slider, {
initComponent: function() {
NS.Slider.superclass.initComponent.apply(this);
},
listeners:{
afterrender:function(){
this.relayEvent();
}
},
relayEvent:function(){
this.relayEvents(this.getEl(),['mouseup']);
}
})

Now mouseup event is available for the slider