【问题标题】:Resetting the slider handles in HorizontalRangeSlider in DOJO在 DOJO 中的 Horizo​​ntal RangeSlider 中重置滑块句柄
【发布时间】:2015-10-27 04:18:01
【问题描述】:

我已经像这样创建了 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();

然后在更改滑块手柄的位置后,现在我想以编程方式重置滑块手柄的位置,为此我正在这样做

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

但这不会影响滑块中的任何内容。如何重置滑块的位置?

【问题讨论】:

    标签: javascript dojo rangeslider


    【解决方案1】:

    仅使用 RangeSlider 的“=”设置值不会触发滑块中的代码更新。对于大多数道场元素,我建议使用以下方法:

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

    这里有一个小技巧:http://jsfiddle.net/g4s05og0/

    【讨论】:

    • @Richard 它没有刷新句柄位置
    • @ManjunathM 我不确定您的代码为什么不起作用。我已经编辑了我的答案,以包括一个它工作的例子。您能否包括一些不起作用的代码?
    猜你喜欢
    • 2012-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-19
    • 1970-01-01
    • 2019-03-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多