@@ -4,15 +4,15 @@ function init(Survey, $) {
44 name : "barrating" ,
55 title : "Bar rating" ,
66 iconName : "icon-barrating" ,
7- widgetIsLoaded : function ( ) {
7+ widgetIsLoaded : function ( ) {
88 return typeof $ == "function" && ! ! $ . fn . barrating ;
99 } ,
1010 defaultJSON : { choices : [ 1 , 2 , 3 , 4 , 5 ] } ,
11- isFit : function ( question ) {
11+ isFit : function ( question ) {
1212 return question . getType ( ) === "barrating" ;
1313 } ,
1414 isDefaultRender : true ,
15- activatedByChanged : function ( activatedBy ) {
15+ activatedByChanged : function ( activatedBy ) {
1616 Survey . JsonObject . metaData . addClass (
1717 "barrating" ,
1818 [
@@ -46,31 +46,35 @@ function init(Survey, $) {
4646 ]
4747 } ) ;
4848 } ,
49- afterRender : function ( question , el ) {
49+ afterRender : function ( question , el ) {
5050 var $el = $ ( el ) . is ( "select" ) ? $ ( el ) : $ ( el ) . find ( "select" ) ;
51+ $el . parents ( ) [ 0 ] . style . marginBottom = "3px" ;
5152 var valueChangingByWidget = false ;
52- var creator = function ( ) {
53+ var creator = function ( ) {
5354 $el . barrating ( "show" , {
5455 theme : question . ratingTheme ,
5556 initialRating : question . value ,
5657 showValues : question . showValues ,
5758 showSelectedRating : false ,
58- onSelect : function ( value , text ) {
59+ onSelect : function ( value , text ) {
5960 valueChangingByWidget = true ;
6061 question . value = value ;
6162 valueChangingByWidget = false ;
6263 }
6364 } ) ;
6465 } ;
6566 creator ( ) ;
66- question . valueChangedCallback = function ( ) {
67- if ( ! valueChangingByWidget && $ ( el ) . find ( "select" ) [ 0 ] . value !== question . value ) {
67+ question . valueChangedCallback = function ( ) {
68+ if (
69+ ! valueChangingByWidget &&
70+ $ ( el ) . find ( "select" ) [ 0 ] . value !== question . value
71+ ) {
6872 $ ( el )
6973 . find ( "select" )
7074 . barrating ( "set" , question . value ) ;
7175 }
7276 } ;
73- question . __barratingOnPropertyChangedCallback = function (
77+ question . __barratingOnPropertyChangedCallback = function (
7478 sender ,
7579 options
7680 ) {
@@ -83,7 +87,7 @@ function init(Survey, $) {
8387 question . __barratingOnPropertyChangedCallback
8488 ) ;
8589 } ,
86- willUnmount : function ( question , el ) {
90+ willUnmount : function ( question , el ) {
8791 var $el = $ ( el ) . find ( "select" ) ;
8892 $el . barrating ( "destroy" ) ;
8993 question . valueChangedCallback = undefined ;
0 commit comments