From b60da89c79e049f9df22633491e46f1bf4d6fe6f Mon Sep 17 00:00:00 2001 From: Aleksey Novikov Date: Mon, 14 Aug 2023 16:26:12 +0300 Subject: [PATCH] #6682 Multiple-Choice Matrix Layout is not adjusted on smaller screens when it has a colummn with Show in Multiple Columns = true Fixes #6682 --- src/question_matrixdropdownbase.ts | 5 ++ src/question_matrixdropdownrendered.ts | 15 ++-- tests/markup/etalon_matrixdropdown.ts | 42 +++++++++- ...-show-in-multiple-columns-mobile.snap.html | 83 +++++++++++++++++++ 4 files changed, 138 insertions(+), 7 deletions(-) create mode 100644 tests/markup/snapshots/matrixdynamic-show-in-multiple-columns-mobile.snap.html diff --git a/src/question_matrixdropdownbase.ts b/src/question_matrixdropdownbase.ts index 271262d9ea..40abf6013b 100644 --- a/src/question_matrixdropdownbase.ts +++ b/src/question_matrixdropdownbase.ts @@ -1408,6 +1408,11 @@ export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel c.hideCaption = false); + } var renderedCell = this.createEditCell(cell); res.cells.push(renderedCell); if (useAsHeader) { @@ -752,7 +755,7 @@ export class QuestionMatrixDropdownRenderedTable extends Base { for (var i = 0; i < columns.length; i++) { var col = columns[i]; if (col.isVisible && col.hasVisibleCell) { - if (col.isShowInMultipleColumns) { + if (this.matrix.IsMultiplyColumn(col)) { this.createMutlipleVerticalRows(renderedRows, col, i); } else { const renderedRow = this.createVerticalRow(col, i); diff --git a/tests/markup/etalon_matrixdropdown.ts b/tests/markup/etalon_matrixdropdown.ts index 1e46a60b72..d8aebe8837 100644 --- a/tests/markup/etalon_matrixdropdown.ts +++ b/tests/markup/etalon_matrixdropdown.ts @@ -40,6 +40,46 @@ registerMarkupTests( after: () => StylesManager.applyTheme("default"), snapshot: "matrixdynamic-show-in-multiple-columns" }, + { + name: "Test matrixdropdown with showInMultipleColumns - mobile", + json: { + elements: [ + { + titleLocation: "hidden", + type: "matrixdropdown", + name: "matrix", + rows: ["row1"], + columns: [ + { + "name": "col1", + "cellType": "radiogroup", + "showInMultipleColumns": true, + "isRequired": true, + "choices": [ + "Item 1", + ] + }, + { + "name": "col2", + "cellType": "checkbox", + "showInMultipleColumns": true, + "isRequired": true, + "choices": [ + "Item 1", + "Item 2", + ] + } + ] + }, + ], + }, + before: () => StylesManager.applyTheme("defaultV2"), + initSurvey(survey) { + survey.setIsMobile(true); + }, + after: () => StylesManager.applyTheme("default"), + snapshot: "matrixdynamic-show-in-multiple-columns-mobile" + }, { name: "Test matrixdropdown errors top", json: { @@ -92,7 +132,7 @@ registerMarkupTests( }, after: () => StylesManager.applyTheme("default"), snapshot: "matrixdropdown-cell-errors-bottom" - } + }, ] ); diff --git a/tests/markup/snapshots/matrixdynamic-show-in-multiple-columns-mobile.snap.html b/tests/markup/snapshots/matrixdynamic-show-in-multiple-columns-mobile.snap.html new file mode 100644 index 0000000000..d8f8794393 --- /dev/null +++ b/tests/markup/snapshots/matrixdynamic-show-in-multiple-columns-mobile.snap.html @@ -0,0 +1,83 @@ +
+ + + + + + + + + + + + + + + + + +
+ + col1 +   + * + + col2 +   + * +
+ row1 + + +
+ +
+
+ +
+ +
+
+
\ No newline at end of file