Matrix Table with Custom Cell Types
Multi-Select Matrix and Dynamic Matrix questions allow respondents to answer questions within matrix cells using a number of built-in editors. This example shows how you can extend the number of available cell editors by using other editors from SurveyJS Form Library or by implementing a custom editor.
By default, Multi-Select Matrix and Dynamic Matrix columns support the cell editors listed in the cellType
property description. These cell editors are based upon standalone question types from SurveyJS Form Library. However, the library also includes other question types. To use them as matrix cell editors, add a property named as the question type to the matrixDropdownColumnTypes
object and assign an empty object to this property. The following code shows how to add the File Upload question type to the list of supported cell editors:
import { matrixDropdownColumnTypes } from "survey-core";
matrixDropdownColumnTypes["file"] = {};
Now, you can create a File Upload matrix column by setting its cellType
property to "file"
in the survey JSON schema. To configure the column, you can use the properties of the standalone question type. For instance, this demo enables the allowMultiple
property for the File Upload column (see the survey.json
file).
The same instructions apply if you want to use a custom question type as a matrix cell editor.