简体   繁体   中英

Resetting the slider handles in HorizontalRangeSlider in DOJO

I have created the HorizontalRangeSlider like this,

    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. For most dojo elements, I'd recommend using the below method:

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

Here's a fiddle with it working: http://jsfiddle.net/g4s05og0/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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