Skip to content

Commit f917f61

Browse files
committed
Fix for #89 - Autocomplete widget not working
1 parent d89072f commit f917f61

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/easy-autocomplete.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,7 @@ function init(Survey, $) {
1616
) {
1717
return;
1818
}
19-
Survey.JsonObject.metaData.addProperty("text", {
20-
name: "choices:itemvalues",
21-
onGetValue: function(obj) {
22-
return Survey.ItemValue.getData(obj.choices || []);
23-
},
24-
onSetValue: function(obj, value) {
25-
if (!obj.choices) {
26-
obj.choices = obj.createItemValues("choices");
27-
}
28-
obj.choices = value;
29-
}
30-
});
19+
Survey.JsonObject.metaData.addProperty("text", "choices:itemvalues");
3120
Survey.JsonObject.metaData.addProperty("text", {
3221
name: "choicesByUrl:restfull",
3322
className: "ChoicesRestfull",
@@ -44,9 +33,10 @@ function init(Survey, $) {
4433
},
4534
afterRender: function(question, el) {
4635
var $el = $(el).is("input") ? $(el) : $(el).find("input");
36+
$el.parents(".sv_qstn")[0].style.overflow = "visible";
4737
var options = {
4838
data: (question.choices || []).map(function(item) {
49-
return item.getData();
39+
return item.text;
5040
}),
5141
adjustWidth: false,
5242
list: {
@@ -69,6 +59,16 @@ function init(Survey, $) {
6959
// };
7060
}
7161
$el.easyAutocomplete(options);
62+
63+
$el[0].oninput = function() {
64+
question.customWidgetData.isNeedRender = true;
65+
};
66+
var updateHandler = function() {
67+
$el[0].value =
68+
typeof question.value === "undefined" ? "" : question.value;
69+
};
70+
question.valueChangedCallback = updateHandler;
71+
updateHandler();
7272
},
7373
willUnmount: function(question, el) {
7474
// var $el = $(el).find("input");

0 commit comments

Comments
 (0)