Ext js 4 slider always show tip demo
Ext.define('AlwaysVisibleTip', {
extend: 'Ext.slider.Tip',
init: function(slider) {
var me = this;
me.callParent(arguments);
slider.removeListener('dragend', me.hide);
slider.on({
scope: me,
change: me.onSlide,
afterrender: function() {
setTimeout(function() {
me.onSlide(slider, null, slider.thumbs[0]);
}, 100);
}
});
}
});
Ext.create('Ext.slider.Single', {
width: 200,
value: 50,
increment: 1,
minValue: 0,
maxValue: 100,
plugins: [Ext.create('AlwaysVisibleTip',{
getText: function(thumb) {
return thumb.value + '%';
}
})],
tipText : function(thumb)
{
return thumb.value + '%';
},
renderTo: Ext.getBody()
});
参考:
http://www.sencha.com/forum/showthread.php?257843-Always-show-the-tip-text-of-Slider-in-Extjs
http://stackoverflow.com/questions/15198053/always-show-the-tip-text-of-slider-in-extjs