Skip to content

Commit

Permalink
Merge pull request #7727 from surveyjs/inheritBaseProps-description
Browse files Browse the repository at this point in the history
Describe `inheritBaseProps`
  • Loading branch information
andrewtelnov authored Jan 24, 2024
2 parents 7bcfd99 + 4e70ff0 commit 869cc70
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If you [add this question to the Toolbox](/Documentation/Survey-Creator?id=toolb
- If the question needs modifications (for example, if the server URL has changed), end users have to modify every created instance of this question individually.
- In the JSON schema, your custom question looks like a regular Dropdown question.

To avoid these drawbacks, use a different approach: add your custom question type to the survey's `ComponentCollection`:
To avoid these drawbacks, use a different approach: add your [custom question type](https://surveyjs.io/form-library/documentation/api-reference/icustomquestiontypeconfiguration) to the survey's `ComponentCollection`:

```js
Survey.ComponentCollection.Instance.add({
Expand All @@ -43,7 +43,9 @@ Survey.ComponentCollection.Instance.add({
"choicesByUrl": {
"url": "https://surveyjs.io/api/CountriesExample",
}
}
},
// Inherit all or individual properties from the base question type
inheritBaseProps: true // or [ "allowClear" ]
});
```

Expand Down
9 changes: 9 additions & 0 deletions src/question_custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ export interface ICustomQuestionTypeConfiguration {
* ```
*/
defaultQuestionTitle?: any;
/**
* An array of property names to inherit from a base question or a Boolean value that specifies whether or not to inherit all properties.
*
* Default value: `false`
*
* When you create a [custom specialized question type](https://surveyjs.io/form-library/documentation/customize-question-types/create-specialized-question-types), you base it on another question type configured within the [`questionJSON`](#questionJSON) object. If the custom question type should inherit all properties from the base type, set the `inheritBaseProps` property to `true`. If you want to inherit only certain properties, set the `inheritBaseProps` property to an array of their names.
*
* [Create Specialized Question Types](https://surveyjs.io/form-library/documentation/customize-question-types/create-specialized-question-types (linkStyle))
*/
inheritBaseProps?: false | true | Array<string>;
/**
* A function that is called when the custom question is created. Use it to access questions nested within a [composite question type](https://surveyjs.io/form-library/documentation/customize-question-types/create-composite-question-types).
Expand Down

0 comments on commit 869cc70

Please sign in to comment.