这是我打算做的:
var tip = new Ext.slider.Tip({
getThumbText: this.getThumbText,
getText: function (thumb) {
return '<b>' + this.getThumbText(thumb.value) + '<b>';
}
});
this.timeSliderLabel = new Ext.form.Label({
text: Nipendo.Localization.HistorySlider + ': ',
style: 'margin:3px 5px 0px 5px;'
});
this.timeSlider = new Ext.Slider({
width: 214,
value: 1,
increment: 1,
minValue: 1,
maxValue: 13,
plugins: tip
});
this.timeSlider.on('change', function (slider, newValue, thumb) {
this.timeSliderHintLabel.setText(this.getThumbText(thumb.value), false);
this.onSearchClick();
}, this);
this.timeSliderHintLabel = new Ext.form.Label({
html: String.format('(1 {0})', Nipendo.Localization.OneMonthBack),
style: 'margin:3px 5px 0px 5px;'
});
更新:
布局可以这样使用:
config = config.apply({
layout: 'column',
defaults: {
layout: 'form'
},
items: [
this.timeSliderLabel,
this.timeSlider,
this.timeSliderHintLabel
]
}, config)
其中 getThumbText 是我用来获取正确标签值的辅助方法。