Question T8094
Visible to All Users

SurveyCreator: NoUiSlider, how can I introduce more complex initialization parameters

created 4 years ago (modified 4 years ago)

Hi,
I'd like to edit some questions containing the NoUISlider.
In particular to be able to access the format property of the noUISlider options to do something like this:

JavaScript
var aproximateHour = function (mins){ if (mins >= 1440) { mins -= 1440; } var minutes = Math.round(mins % 60); if (minutes == 60 || minutes == 0) { return mins / 60;} return Math.trunc (mins / 60) + minutes / 100; } noUiSlider.create(noUISliderItem, { start : 240, behaviour: 'tap-drag', step: 15, tooltips: true, range : {'min': 1200, 'max': 1620}, format: wNumb({ decimals: 2, mark: ":", encoder: function(a){ return aproximateHour(a); } }), pips: { mode : 'steps', format: wNumb({ decimals: 0, encoder: function(a ){ return aproximateHour(a); } }), filter : filter_hour, stepped : true, density:4 } }); function filter_hour(value, type) { return (value % 60 == 0) ? 2 : 0; }

Answers approved by surveyjs Support

created 4 years ago

Hello,

The SurveyJS custom widgets library was started as a community driven project. It should help to integrate 3rd party controls with SurveyJS products. And the noUISlider is one of them. In case of deep customization of a custom widget you can simply take a widget source code https://github.com/surveyjs/custom-widgets/blob/master/src/nouislider.js include it in your project and customize according your requirements.

Thanks, Serge
SurveyJS Team