File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,14 @@ function init(Survey, $) {
3131 } ) ;
3232 Survey . JsonObject . metaData . addProperty ( "dropdown" , {
3333 name : "select2Config" ,
34- default : { }
34+ default : null
3535 } ) ;
3636 }
3737 if ( activatedBy == "customtype" ) {
3838 Survey . JsonObject . metaData . addClass ( "select2" , [ ] , null , "dropdown" ) ;
3939 Survey . JsonObject . metaData . addProperty ( "select2" , {
4040 name : "select2Config" ,
41- default : { }
41+ default : null
4242 } ) ;
4343 }
4444 } ,
@@ -68,8 +68,18 @@ function init(Survey, $) {
6868 var updateChoices = function ( ) {
6969 $el . select2 ( ) . empty ( ) ;
7070
71- if ( settings . ajax ) {
72- $el . select2 ( settings ) ;
71+ if ( settings ) {
72+ if ( settings . ajax ) {
73+ $el . select2 ( settings ) ;
74+ } else {
75+ settings . data = question . visibleChoices . map ( function ( choice ) {
76+ return {
77+ id : choice . value ,
78+ text : choice . text
79+ } ;
80+ } ) ;
81+ $el . select2 ( settings ) ;
82+ }
7383 } else {
7484 $el . select2 ( {
7585 theme : "classic" ,
@@ -81,6 +91,7 @@ function init(Survey, $) {
8191 } )
8292 } ) ;
8393 }
94+
8495 updateValueHandler ( ) ;
8596 updateCommentHandler ( ) ;
8697 } ;
You can’t perform that action at this time.
0 commit comments