Skip to content

Commit 86e024f

Browse files
committed
Fix: SelectBase has wrong ItemValue instances in markup after question converted to other type #834
1 parent 7f08db7 commit 86e024f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/questionconverter.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,9 @@ export class QuestionConverter {
3535
convertToClass: string
3636
): Survey.Question {
3737
if (!obj || !obj.parent || convertToClass == obj.getType()) return null;
38-
var newQuestion = Survey.QuestionFactory.Instance.createQuestion(
39-
convertToClass,
40-
obj.name
41-
);
42-
var jsonObj = new Survey.JsonObject();
43-
var json = jsonObj.toJsonObject(obj);
44-
jsonObj.toObject(json, newQuestion);
38+
var newQuestion = Survey.Serializer.createClass(convertToClass);
39+
newQuestion.name = obj.name;
40+
newQuestion.fromJSON(obj.toJSON());
4541
var panel = <Survey.PanelModelBase>obj.parent;
4642
var index = panel.elements.indexOf(obj);
4743
panel.removeElement(obj);

0 commit comments

Comments
 (0)