Skip to content

Commit

Permalink
Fix: SelectBase has wrong ItemValue instances in markup after questio…
Browse files Browse the repository at this point in the history
…n converted to other type #834
  • Loading branch information
andrewtelnov committed Jun 10, 2020
1 parent 7f08db7 commit 86e024f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/questionconverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@ export class QuestionConverter {
convertToClass: string
): Survey.Question {
if (!obj || !obj.parent || convertToClass == obj.getType()) return null;
var newQuestion = Survey.QuestionFactory.Instance.createQuestion(
convertToClass,
obj.name
);
var jsonObj = new Survey.JsonObject();
var json = jsonObj.toJsonObject(obj);
jsonObj.toObject(json, newQuestion);
var newQuestion = Survey.Serializer.createClass(convertToClass);
newQuestion.name = obj.name;
newQuestion.fromJSON(obj.toJSON());
var panel = <Survey.PanelModelBase>obj.parent;
var index = panel.elements.indexOf(obj);
panel.removeElement(obj);
Expand Down

0 comments on commit 86e024f

Please sign in to comment.