seiyria / bootstrap-slider

A slider control for Bootstrap 3 & 4.
http://seiyria.github.io/bootstrap-slider/
Other
3k stars 1.14k forks source link

ticks can not be updated after slider created #859

Closed Stephen-Z closed 5 years ago

Stephen-Z commented 5 years ago

Issues

GLOBALSLIDER = $('#ex22').slider({
                id: 'slider22',
                min: minNum,
                max: maxNum,
                step: 1,
                value: 1,
                ticks: [1,2,3,4],
                tooltip: 'always',
                formatter: function (val) {

                    const baseDate = new Date("2012-01-01").getTime()
                    const newDateTimes = (val * (3600 * 24 * 1000 * 31)) + baseDate
                    return handleDate(newDateTimes);
                }
       });

I use above code to create a slider, then when I type GLOBALSLIDER.slider("setAttribute","ticks",[]) or GLOBALSLIDER.slider({ticks:[]}) the ticks of the slider wouldn't changes . I have tried invoke GLOBALSLIDER.slider("refresh") still nothing changes..... Can I manpulate the ticks attribute without re-create the slider?

huajie6 commented 5 years ago

try $('#ex22').slider("destroy")

Stephen-Z commented 5 years ago

yes,I think the only way is to recreate the slider instances