surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.21k stars 814 forks source link

Multi-Select Matrix with Rating Scale Column Does not display configured choices #7752

Closed JaneSjs closed 9 months ago

JaneSjs commented 9 months ago

User Issue: T16575 - Rating scale in Multi-select matrix is not rendered correctly https://surveyjs.answerdesk.io/internal/ticket/details/T16575


A matrix uses a Rating scale column with the following choices:

{
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "matrixdropdown",
     "name": "question1",
     "columns": [
      {
       "name": "Column 1"
      },
      {
       "name": "Column 2"
      },
      {
       "name": "Column 3"
      }
     ],
     "choices": [
      "M",
      "L"
     ],
     "cellType": "rating",
     "rows": [
      "Row 1",
      "Row 2"
     ]
    }
   ]
  }
 ]
}

image

However, these choices do not appear in preview: image

JaneSjs commented 9 months ago

It appears that a matrix column was configured incorrectly. A Rating scale has a rateValues collection, not choices. The choices collection is used by the choice-based questions (e.g., Rating, Dropdown). If you wish to configure a rating scale within matrix column, configure the rateValues collection for individual matrix columns.

The proper configuration is shown below.

{
 "logoPosition": "right",
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "matrixdropdown",
     "name": "question1",
     "columns": [
      {
       "name": "Column 1",
       "title": "1",
       "cellType": "rating",
       "autoGenerate": false,
       "rateCount": 2,
       "rateValues": [
        "M",
        "L"
       ]
      },
      {
       "name": "Column 2",
       "title": "2",
       "cellType": "rating",
       "autoGenerate": false,
       "rateCount": 2,
       "rateValues": [
        "M",
        "L"
       ]
      },
      {
       "name": "Column 3",
       "title": "3",
       "cellType": "rating",
       "autoGenerate": false,
       "rateCount": 2,
       "rateValues": [
        "M",
        "L"
       ]
      }
     ],
     "choices": [
      1,
      2,
      3,
      4,
      5
     ],
     "rows": [
      "Row 1",
      "Row 2"
     ]
    }
   ]
  }
 ]
}