diff --git a/packages/survey-core/src/question_multipletext.ts b/packages/survey-core/src/question_multipletext.ts index e631a6093a..3d749bd8df 100644 --- a/packages/survey-core/src/question_multipletext.ts +++ b/packages/survey-core/src/question_multipletext.ts @@ -459,6 +459,9 @@ export class QuestionMultipleTextModel extends Question onSurveyLoad() { this.editorsOnSurveyLoad(); super.onSurveyLoad(); + if(!Helpers.isValueEmpty(this.rows)) { + this.calcVisibleRows(); + } } setQuestionValue(newValue: any, updateIsAnswered: boolean = true) { super.setQuestionValue(newValue, updateIsAnswered); @@ -649,7 +652,6 @@ export class QuestionMultipleTextModel extends Question protected onRowCreated(row: MutlipleTextRow) { return row; } - private calcVisibleRows() { const colCount = this.colCount; const items = this.items; diff --git a/packages/survey-core/tests/question_multipletexttests.ts b/packages/survey-core/tests/question_multipletexttests.ts index b7fbe7cc3f..fb75455f1e 100644 --- a/packages/survey-core/tests/question_multipletexttests.ts +++ b/packages/survey-core/tests/question_multipletexttests.ts @@ -242,6 +242,40 @@ QUnit.test("defaultValueExpression executing", (assert) => { q1.items[1].value = 5; assert.equal(q1.items[2].editor.value, 15, "Calculated correctly"); }); +QUnit.test("Make inputSize invisible by default", (assert) => { + const prop = Serializer.findProperty("multipletext", "inputSize"); + assert.strictEqual(prop.visible, false); +}); +QUnit.test("mutltipletext fromJSON, bug#9400", (assert) => { + const survey = new SurveyModel({ + questions: [ + { + type: "multipletext", + name: "q1", + items: [ + { + name: "item1" + }, + { + name: "item2" + }, + { + name: "item3", + defaultValueExpression: "{q1.item1} + {q1.item2}" + } + ] + } + ] + }); + const q1 = survey.getQuestionByName("q1"); + const q2 = survey.currentPage.addNewQuestion("multipletext", "q2"); + assert.equal(q2.rows.length, 2 * 2, "rows #1"); + const json = q1.toJSON(); + delete json["name"]; + q2.fromJSON(json); + assert.equal(q2.items.length, 3, "items"); + assert.equal(q2.rows.length, 3 * 2, "rows # 2"); +}); QUnit.test("Make inputSize invisible by default", (assert) => { const prop = Serializer.findProperty("multipletext", "inputSize"); assert.strictEqual(prop.visible, false);