loveforfire33
loveforfire33

Reputation: 1120

noUiSlider "Must pass a formatter for all handles" with tooltip formatting

When i try and format the decimal places of the tooltip i get the following error. Unsure why as im copy pasting the tooltip line from the documentation.

"Uncaught Error: noUiSlider: must pass a formatter for all handles."

jQuery(document).ready(function(){
var frequencySlider = document.getElementById('frequencySlider');

noUiSlider.create(frequencySlider, {
    start: [ 4 ],
    step: 1,
    range: {
        'min': [  1 ],
        'max': [ 40 ]
    },
        tooltips: [true, wNumb({ decimals: 1 })],
    pips: {
        mode: 'values',
        values: [1, 10, 20, 30, 40],
        density: 100,
        stepped: true,
    }

});



var frequencyNumber = document.getElementById('rangePickerTextMonthly');

frequencySlider.noUiSlider.on('update', function( values, handle ) {

    var value = values[handle];
        frequencyNumber.value = value;
            optionChange();
});



frequencyNumber.addEventListener('change', function(){
    frequencySlider.noUiSlider.set([null, this.value]);
});

});

Upvotes: 1

Views: 3670

Answers (1)

Stathis Papalefkas
Stathis Papalefkas

Reputation: 121

The start option sets the number of handles and corresponding start positions. In your example, you have two tooltips formatter

    tooltips: [true, wNumb({ decimals: 1 })]

Instead you need one for your only handle

    tooltips: [true] 

Or

    tooltips: [ wNumb({ decimals: 1 })]

If you want to show tooltips for all Handles just use tooltips : true and if not use tooltips : false

Upvotes: 7

Related Questions