@@ -12,7 +12,10 @@ function init(Survey) {
1212    } , 
1313    isDefaultRender : true , 
1414    activatedByChanged : function ( activatedBy )  { 
15-       if  ( Survey . JsonObject . metaData . findProperty ( "text" ,  "choices" )  !==  null )  { 
15+       if  ( 
16+         Survey . JsonObject . metaData . findProperty ( "text" ,  "choices" )  !==  null  || 
17+         Survey . JsonObject . metaData . findProperty ( "text" ,  "choicesByUrl" )  !==  null 
18+       )  { 
1619        return ; 
1720      } 
1821      Survey . JsonObject . metaData . addProperty ( "text" ,  { 
@@ -24,13 +27,35 @@ function init(Survey) {
2427          obj . choices  =  value ; 
2528        } 
2629      } ) ; 
30+       Survey . JsonObject . metaData . addProperty ( "text" ,  { 
31+         name : "choicesByUrl:restfull" , 
32+         className : "ChoicesRestfull" , 
33+         onGetValue : function ( obj )  { 
34+           return  obj . choicesByUrl . getData ( ) ; 
35+         } , 
36+         onSetValue : function ( obj ,  value )  { 
37+           if  ( ! obj . choicesByUrl )  { 
38+             obj . choicesByUrl  =  new  Survey . ChoicesRestfull ( ) ; 
39+           } 
40+           obj . choicesByUrl . setData ( value ) ; 
41+         } 
42+       } ) ; 
2743    } , 
2844    afterRender : function ( question ,  el )  { 
2945      var  $el  =  $ ( el ) . is ( "input" )  ? $ ( el )  : $ ( el ) . find ( "input" ) ; 
3046      var  options  =  { 
3147        data : question . choices , 
3248        placeholder : question . placeholder 
3349      } ; 
50+       if  ( ! ! question . choicesByUrl )  { 
51+         options . url  =  function ( phrase )  { 
52+           return  question . choicesByUrl . url ; 
53+         } ; 
54+         options . getValue  =  question . choicesByUrl . valueName ; 
55+         // options.ajaxSettings = { 
56+         //   dataType: "jsonp" 
57+         // }; 
58+       } 
3459      $el . easyAutocomplete ( options ) ; 
3560    } , 
3661    willUnmount : function ( question ,  el )  { 
0 commit comments