Hello everyone,
if i create a custom question like below. How can i add default text to the minimumLabel panel input.
Codeexport class QuestionColorModel extends Question {
constructor(name) {
super(name);
this.createLocalizableString("minimumLabel", this, true);
this.createLocalizableString("maximumLabel", this, true);
}
getType() {
return "color";
}
get minimumLabel() {
return this.getLocalizableStringText("minimumLabel");
}
set minimumLabel(val) {
this.setLocalizableStringText("minimumLabel", val);
}
get locMinimumLabel() {
return this.getLocalizableString("minimumLabel");
}
get maximumLabel() {
return this.getLocalizableStringText("maximumLabel");
}
set maximumLabel(val) {
this.setLocalizableStringText("maximumLabel", val);
}
get locMaximumLabel() {
return this.getLocalizableString("maximumLabel");
}
}
and adding class info:
CodeSerializer.addClass("color",[
{
name: "minimumLabel",
displayName: "Mininimum Label",
serializationProperty: "locMinimumLabel",
category: "Label"
},
{
name: "maximumLabel",
displayName: "Maximum Label",
serializationProperty: "locMaximumLabel",
category: "Label"
},
}
],
function () {
return new QuestionColorModel("");
},
"question"
);
Hello Cef,
You can specify a default value for a custom property using the default property. You can find an example in our documentation: https://surveyjs.io/survey-creator/documentation/property-grid#default.
Please let me know if it helps.