将提示文本动态添加到滑块 [英] Add tip text dynamically to a slider
问题描述
在我的项目中,我试图添加 提示文本
(config)动态地移动到滑块。怎么做?
我需要动态添加它,因为我在Controller中生成变量数组,它保存滑块每个值的文本(对于提示文本)。
In my project, I am trying to add the tip text
(config) dynamically to a slider. How to do that?
I need to add it dynamically because I am generating the array of variables in a "Controller", which holds the text for each value of the slider (for tip text).
var slider = Ext.getCmp('slider')
slider.setTipText(arrayOfVariables) //What should I do here instead?
没有像 setTipText
这样的方法文档。我应该怎么用?
There is no such method like setTipText
in docs. What should I use then?
编辑:
{
xtype:'slider',
animate: false,
//plugins: [Ext.create('App.view.SliderOverride')],
cls: 'sliderStyle',
width: "80%",
id: 'slider',
value: 36/2, //must be current month
//increment: 10,
minValue: 1,
maxValue: 36,
useTips: true,
tipText: function(thumb){
alert("hello");
App.getController('TaskController')._arrMonthView[thumb.value].month;
},
},
推荐答案
我使用 getText
Ext.slider.Tip方法。
I solved this issue by using getText
method of Ext.slider.Tip.
用于创建提示的正文中显示的文本。默认情况下,这只是返回Tip附加到的Slider Thumb的值。覆盖以自定义。
Used to create the text that appears in the Tip's body. By default this just returns the value of the Slider Thumb that the Tip is attached to. Override to customize.
例如,在哪种情况下可以使用,您可以看看这个 link
For example in which situation it can be used, you have a look at this link
这篇关于将提示文本动态添加到滑块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!