File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1- import $ from 'jquery' ;
2-
31function init ( Survey ) {
42 var widget = {
53 name : "imagepicker" ,
64 title : "Image picker" ,
75 iconName : "icon-imagepicker" ,
8- widgetIsLoaded : function ( ) { return typeof ImagePicker !== undefined ; } ,
6+ widgetIsLoaded : function ( ) { return ! ! $ . fn . imagepicker ; } ,
97 isFit : function ( question ) { return question . getType ( ) === 'imagepicker' ; } ,
108 isDefaultRender : true ,
119 activatedByChanged : function ( activatedBy ) {
@@ -17,8 +15,10 @@ function init(Survey) {
1715 afterRender : function ( question , el ) {
1816 var $el = $ ( el ) . is ( "select" ) ? $ ( el ) : $ ( el ) . find ( "select" ) ;
1917 var options = $el . find ( 'option' ) ;
20- for ( var i = 1 ; i < options . length ; i ++ ) {
21- $ ( options [ i ] ) . data ( "imgSrc" , options [ i ] . imageLink ) ;
18+ var choices = question . choices ;
19+
20+ for ( var i = 1 ; i < options . length && i - 1 < choices . length ; i ++ ) {
21+ $ ( options [ i ] ) . data ( "imgSrc" , choices [ i - 1 ] . imageLink ) ;
2222 options [ i ] . selected = question . value == options [ i ] . value ;
2323 }
2424 $el . imagepicker ( {
You can’t perform that action at this time.
0 commit comments