Skip to content

Commit 27b94d7

Browse files
committed
Fixed image picker custom widget property declarations (https://surveyjs.answerdesk.io/internal/ticket/details/T327)
1 parent a1c3691 commit 27b94d7

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/image-picker.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,16 @@ function init(Survey, $) {
1414
activatedByChanged: function(activatedBy) {
1515
Survey.JsonObject.metaData.addClass(
1616
"imageitemvalues",
17-
[{ name: "imageLink" }],
17+
[],
1818
null,
1919
"itemvalue"
2020
);
21+
Survey.JsonObject.metaData.addProperty("imagepicker", {
22+
name: "imageLink"
23+
});
2124
Survey.JsonObject.metaData.addClass(
2225
"imagepicker",
2326
[
24-
{
25-
name: "choices:imageitemvalues",
26-
onGetValue: function(obj) {
27-
return Survey.ItemValue.getData(obj.choices);
28-
},
29-
onSetValue: function(obj, value) {
30-
obj.choices = value;
31-
}
32-
},
33-
{ name: "showLabel:boolean", default: false },
3427
{ name: "hasOther", visible: false },
3528
{ name: "otherText", visible: false },
3629
{ name: "optionsCaption", visible: false },
@@ -41,6 +34,19 @@ function init(Survey, $) {
4134
null,
4235
"dropdown"
4336
);
37+
Survey.JsonObject.metaData.addProperty("imagepicker", {
38+
name: "showLabel:boolean",
39+
default: false
40+
});
41+
Survey.JsonObject.metaData.addProperty("imagepicker", {
42+
name: "choices:imageitemvalues",
43+
onGetValue: function(obj) {
44+
return Survey.ItemValue.getData(obj.choices);
45+
},
46+
onSetValue: function(obj, value) {
47+
obj.choices = value;
48+
}
49+
});
4450
},
4551
afterRender: function(question, el) {
4652
var $el = $(el).is("select") ? $(el) : $(el).find("select");

0 commit comments

Comments
 (0)