Skip to content

Instantly share code, notes, and snippets.

@silviot
Created June 12, 2012 13:50
Show Gist options
  • Save silviot/2917623 to your computer and use it in GitHub Desktop.
Save silviot/2917623 to your computer and use it in GitHub Desktop.
Ext.define('RIP.LabeledSlider',{
/* A slider that shows its value next to it*/
extend: 'Ext.field.Slider',
xtype: 'labeledslider',
updateToolTip: function() {
this.valuediv.innerHTML = this.getValue();
},
reset: function() {
this.callParent(arguments);
this.updateToolTip();
},
config: {
listeners: {
initialize: function() {
this.element.appendChild(Ext.Element.create({
'tag':'div', class:'sliderValue', html:0,
'style': 'font-weight: bold; padding: 18px 11px; width:2.5em'
}));
this.valuediv = this.element.query('.sliderValue')[0];
this.getComponent().on({
scope: this,
drag: 'updateToolTip'
});
this.on({
scope: this,
change: 'updateToolTip',
show: 'updateToolTip'
});
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment