leongersen / noUiSlider

noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.
https://refreshless.com/nouislider/
MIT License
5.66k stars 659 forks source link

updateOptions - tooltips can't be set to a single formatter #1140

Closed s-cork closed 3 years ago

s-cork commented 3 years ago

extension of issue #1101 I think.

leongersen commented 3 years ago

Could you add an example?

The following works as expected:

var format = { to: ..., from: ... };

noUiSlider.create(slider, {
    start: [20, 80],
    range: { 'min': 0, 'max': 100 }
});

slider.noUiSlider.updateOptions({ tooltips: format });
s-cork commented 3 years ago

right you are - I think i'd done something strange when I was hacking around.

Love the library btw.

leongersen commented 3 years ago

Ok good - Glad you find it useful :)

s-cork commented 3 years ago

I know what it was - I tried to update a tooltip with just a {'to': ...} as a formatter. Since I figured tooltips didn't need a {'from': ...}.

The following code breaks with the error: noUiSlider: must pass a formatter for all handles

var format = { to: ... };

noUiSlider.create(slider, {
    start: [20, 80],
    range: { 'min': 0, 'max': 100 }
});

slider.noUiSlider.updateOptions({ tooltips: format });

But the code would have worked fine if i'd passed in the same formatter like tooltips: [format, format]

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.