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

How to use format (from, to) with range slider? #1141

Closed Venegrad closed 3 years ago

Venegrad commented 3 years ago

How to use format (from, to) with range slider? I have 2 caption for 2 fields, from and to, but in docs i see only one value, not array. How to set format for second hander?

 format: {
        to: (value) => {
          return value
          //return parseInt(value).toLocaleString("ru-RU") + " " + p_min;
        },
        from: () => {
          console.log(value)

          return value
          // return Number(value.replace(/\s/g, "").replace(p_min, ""));
        },
      },
leongersen commented 3 years ago

The format option applies to all handles. Note that your from method is missing it's argument.

Venegrad commented 3 years ago

ye, but how i can validate them? to set different caption for 2 handlers?

Venegrad commented 3 years ago

if i have an array, i can use value[0] value[1] and use it when validate, but in this case, i cant undestand, cuz i have only 2 string, can someone show me example?

Venegrad commented 3 years ago

if first hander (have caption "from") and second (have caption "to"). How i can use format?

Venegrad commented 3 years ago

up

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.