简体   繁体   English

在DOJO中的Horizo​​ntalRangeSlider中重置滑块手柄

[英]Resetting the slider handles in HorizontalRangeSlider in DOJO

I have created the HorizontalRangeSlider like this, 我这样创建了Horizo​​ntalRangeSlider

    this.horizontalSlider = new HorizontalRangeSlider({
            name : "slider",
            //To place the slider handles at min max.
            value : [10,100],
            minimum : 10,
            maximum : 100,
            intermediateChanges : false,
            showButtons : false,
            onChange : //onChange call method.
        }, this.slider);
        this.horizontalSlider.startup();

        this.horizontalSliderRule = new HorizontalRule({
            container : "topDecoration",
            style:"height:5px",
            count : 2,              
            numericMargin: 1
        }, this.sliderRule);
        this.horizontalSliderRule.startup();

Then after changing the position of the slider handles now i want to reset the position of the slider handles programmatically, for this i am doing like this 然后,在更改滑杆手柄的位置之后,现在我要以编程方式重置滑杆手柄的位置,为此,我这样做

this.horizontalSlider.value=[10,100];

But this is not affecting anything in the slider.How to reset the position of the slider? 但这不会影响滑块中的任何内容。如何重置滑块的位置?

Simply setting the values by way of using "=" of the RangeSlider won't trigger the code in the slider to update. 通过使用RangeSlider的“ =”简单地设置值将不会触发滑块中的代码进行更新。 For most dojo elements, I'd recommend using the below method: 对于大多数dojo元素,我建议使用以下方法:

this.horizontalSlider.set("value",[10,100]);

Here's a fiddle with it working: http://jsfiddle.net/g4s05og0/ 这是一个工作正常的小提琴: http : //jsfiddle.net/g4s05og0/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM