@@ -5,14 +5,14 @@ function init(Survey) {
55 name : "nouislider" ,
66 title : "noUiSlider" ,
77 iconName : "icon-nouislider" ,
8- widgetIsLoaded : function ( ) {
8+ widgetIsLoaded : function ( ) {
99 return typeof noUiSlider != "undefined" ;
1010 } ,
11- isFit : function ( question ) {
11+ isFit : function ( question ) {
1212 return question . getType ( ) === "nouislider" ;
1313 } ,
1414 htmlTemplate : "<div></div>" ,
15- activatedByChanged : function ( activatedBy ) {
15+ activatedByChanged : function ( activatedBy ) {
1616 Survey . JsonObject . metaData . addClass ( "nouislider" , [ ] , null , "empty" ) ;
1717 Survey . JsonObject . metaData . addProperties ( "nouislider" , [
1818 {
@@ -41,7 +41,7 @@ function init(Survey) {
4141 }
4242 ] ) ;
4343 } ,
44- afterRender : function ( question , el ) {
44+ afterRender : function ( question , el ) {
4545 el . style . marginBottom = "60px" ;
4646 var slider = noUiSlider . create ( el , {
4747 start : question . value || ( question . rangeMin + question . rangeMax ) / 2 ,
@@ -50,7 +50,7 @@ function init(Survey) {
5050 tooltips : true ,
5151 pips : {
5252 mode : question . pipsMode || "positions" ,
53- values : question . pipsValues . map ( function ( pVal ) {
53+ values : question . pipsValues . map ( function ( pVal ) {
5454 return parseInt ( ( pVal . value !== undefined && pVal . value ) || pVal ) ;
5555 } ) ,
5656 density : question . pipsDensity || 5
@@ -60,10 +60,10 @@ function init(Survey) {
6060 max : question . rangeMax
6161 }
6262 } ) ;
63- slider . on ( "change" , function ( ) {
63+ slider . on ( "change" , function ( ) {
6464 question . value = slider . get ( ) ;
6565 } ) ;
66- var updateValueHandler = function ( ) {
66+ var updateValueHandler = function ( ) {
6767 slider . set ( question . value ) ;
6868 } ;
6969 if ( question . isReadOnly ) {
@@ -72,17 +72,19 @@ function init(Survey) {
7272 updateValueHandler ( ) ;
7373 question . noUiSlider = slider ;
7474 question . valueChangedCallback = updateValueHandler ;
75- question . readOnlyChangedCallback = function ( ) {
75+ question . readOnlyChangedCallback = function ( ) {
7676 if ( question . isReadOnly ) {
7777 el . setAttribute ( "disabled" , true ) ;
7878 } else {
7979 el . removeAttribute ( "disabled" ) ;
8080 }
8181 } ;
8282 } ,
83- willUnmount : function ( question , el ) {
84- question . noUiSlider . destroy ( ) ;
85- question . noUiSlider = null ;
83+ willUnmount : function ( question , el ) {
84+ if ( ! ! question . noUiSlider ) {
85+ question . noUiSlider . destroy ( ) ;
86+ question . noUiSlider = null ;
87+ }
8688 question . readOnlyChangedCallback = null ;
8789 }
8890 } ;
0 commit comments