Some of the attribute panels on the right side of matrix and multiple-choice question types cannot be accessed, so I added inheritBaseProps: ["columns","rows","choices"], However, in this case, when the property panel on the right was previously set to inheritBaseProps: true, some properties may not appear, so I have set a particularly long set of properties for inheritBaseProps for you. How can the inheritBaseProps method be set to both retain the inheritBaseProps: true attribute and add the inheritBaseProps: ["columns", "rows", "choices"] attribute? (On our left side, we have customized various types of questions.)
CodequestionList.forEach((item)=>{
const questionContent=JSON.parse(item.questionContent)
let inheritBasePropsCustom=['radiogroup','checkbox','matrix','matrixdropdown','matrixdynamic','dropdown','text']
let inheritBaseProps=true;
if(inheritBasePropsCustom.includes(questionContent.type)){
inheritBaseProps=["columns","rows","choices","separateSpecialChoices","maxSelectedChoices","minSelectedChoices","selectAllText","showSelectAllItem","showClearButton","dontKnowText","refuseText","noneText","showNoneItem","otherPlaceholder","otherText","showOtherItem","choicesOrder","choiceTextsFromQuestion","choiceValuesFromQuestion","choicesFromQuestionMode","choicesFromQuestion","showCommentArea","commentPlaceholder","commentText","colCount","choicesMin","choicesMax","choicesStep","allowClear","searchMode","textWrapEnabled","rowsOrder","hideIfRowsEmpty","effectiveColSpan","showHeader","columnMinWidth","rowTitleWidth","alternateRows","verticalAlign","requiredErrorText","isAllRowRequired","eachRowUnique","cells","cellType","detailPanelMode","detailPanelShowOnAdding","allowAddRows","allowRemoveRows","allowRowsDragAndDrop","rowCount","minRowCount","maxRowCount","addRowLocation","addRowText","removeRowText","confirmDelete","confirmDeleteText","placeholder","hideColumnsIfEmpty","emptyRowsText","transposeData","columnColCount","defaultValue","correctAnswer","useDisplayValuesInDynamicTexts","keyName","keyDuplicationError","cellErrorLocation","defaultRowValue","defaultValueFromLastRow","totalText","inputType","min","max","step","autocomplete","maxLength","minErrorText","maxErrorText","inputTextAlignment"]
}
CombineJson.push({
name:item.id+'',
title:item.name?item.name:'',
defaultQuestionTitle:'',
questionJSON:questionContent,
inheritBaseProps:inheritBaseProps,
iconName:' ',
customQuestionCode:item.code+'',
customQuestionId:item.id+'',
customQuestionVersion:item.version+'',
showInToolbox:item.isShowInToolbox=='1'?false:true,
})
CombineJson.forEach((item)=>{
ComponentCollection.Instance.add(item);
})
})
Hello,
If you wish to inherit all question settings, set the
inheritBaseProps
attribute totrue
. If you wish to inherit specific properties only, list them within theinheritBaseProps
array. I created the following demo for your reference: View CodeSandbox. It uses the following specialized question definitions:import { ComponentCollection } from "survey-core"; ComponentCollection.Instance.add({ name: "radiogrouptemplate", questionJSON: { type: "radiogroup", choices: ["Item 1", "Item 2", "Item 3"], }, inheritBaseProps: ["choices"], }); ComponentCollection.Instance.add({ name: "checkboxtemplate", questionJSON: { type: "checkbox", choices: ["Item 1", "Item 2", "Item 3"], }, inheritBaseProps: ["choices"], }); ComponentCollection.Instance.add({ name: "matrixtemplate", questionJSON: { type: "matrix", columns: ["Column 1", "Column 2", "Column 3"], rows: ["Row 1", "Row 2"], }, inheritBaseProps: ["rows", "columns"], }); ComponentCollection.Instance.add({ name: "matrixdropdownemplate", questionJSON: { type: "matrixdropdown", columns: [ { name: "Column 1", }, { name: "Column 2", }, { name: "Column 3", }, ], choices: [1, 2, 3, 4, 5], rows: ["Row 1", "Row 2"], }, inheritBaseProps: ["rows", "columns"], });
Please let me know if you have any further questions.